yusijie
2023-06-28 4cf8cdb357e04b1004b0fdfe3ed3dc367f0dd0c2
生产退料单
2个文件已修改
81 ■■■■ 已修改文件
WebAPI/Controllers/POStockInBillController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/条码管理/WEBSController.cs 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/POStockInBillController.cs
@@ -969,7 +969,7 @@
                    string text4 = ClsPub.isStrNull(dataSet2.Tables[0].Rows[0]["HModel"]);
                    long num3 = (long)ClsPub.isInt(dataSet2.Tables[0].Rows[0]["HUnitID"]);
                    text = str3 + num2.ToString() + text2  + "#" + num;
                    text1 = str3 + num2.ToString() + text2;
                    text1 = str3 + num2.ToString() + text2;//组织代码+物料id+批号
                    //找源单
                    DataSet dataSet3 = clsCN.RunProcReturn(" select fid,FMATERIALID,FENTRYID,FBILLNO from h_v_RECEIVEQuery where FSRCBILLNO= '" + str2 + "' and  FLOT_TEXT = '" + text2 + "' and  FMATERIALID = " + num2.ToString(), "h_v_RECEIVEQuery");
                    //DataSet dataSet3 = clsCN.RunProcReturn(" select fid,FMATERIALID,FENTRYID,FBILLNO from h_v_RECEIVEQuery where FLOT_TEXT= '" + text2 + "' and FPRODUCEDATE = '" + dateTime + "' and  FMATERIALID = " + num2.ToString(), "h_v_RECEIVEQuery");
WebAPI/Controllers/ÌõÂë¹ÜÀí/WEBSController.cs
@@ -940,34 +940,71 @@
                }
                try
                {
                    oCn.BeginTran();//开始事物
                    WebSoBar = oWebs.get_BarCode(sJXCode, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HStockOrgID, HScanStyle, HCustom1, HCustom2, ref DBUtility.ClsPub.sErrInfo);
                    if (oSystemParameter.omodel.WMS_CampanyName == "安瑞" && int.Parse(HBillType) == 1244)
                    {
                        ds = oCn.RunProcReturn("select HMaterID,HQty,HBatchNo from KF_PonderationBillMain_Temp where HInterID = " + HInterID + "and HBillNo = '" + HBillNo + "'", "KF_PonderationBillMain_Temp");
                        string[] arr = sBarCode.Split('@');
                        string HMaterNumber = arr[0]; //物料代码
                        string HBatchNo = arr[6]; //批次
                        string HMaterQty = arr[4]; //数量
                        string HMaterID = "";
                        //用拆分出来的物料代码查询物料表里的物料id
                        DataSet ds_material;
                        ds_material = oCn.RunProcReturn(" select FMATERIALID from AIS20220914133941..T_BD_MATERIAL where FNumber = '" + HMaterNumber + "' and FUSEORGID = " + HStockOrgID, "T_BD_MATERIAL");
                        if (ds_material != null || ds_material.Tables[0].Rows.Count > 0)
                        {
                            HMaterID = ds_material.Tables[0].Rows[0]["FMATERIALID"].ToString();
                        }
                        else
                        {
                            //新物编码里没有返回数据则查询物料表里的旧物料编码
                            DataSet ds_material_old;
                            ds_material_old = oCn.RunProcReturn(" select FMATERIALID from AIS20220914133941..T_BD_MATERIAL where FOldNumber = '" + HMaterNumber + "' and FUSEORGID =" + HStockOrgID, "T_BD_MATERIAL");
                            if (ds_material_old != null || ds_material_old.Tables[0].Rows.Count > 0)
                            {
                                HMaterID = ds_material_old.Tables[0].Rows[0]["FMATERIALID"].ToString();
                            }
                            else
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "没有查询到物料信息!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                        }
                        ds = oCn.RunProcReturn("select HMaterID,HQty,HBatchNo from KF_PonderationBillMain_Temp where HInterID = " + HInterID + "and HBillNo = '" + HBillNo + "' and HMaterID = " + HMaterID + " and HBatchNo = '" + HBatchNo + "' and HQty = " + HMaterQty, "KF_PonderationBillMain_Temp");
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            for (var i = 0; i < ds.Tables[0].Rows.Count; i++)
                            {
                                for (var j = i + 1; j < ds.Tables[0].Rows.Count; j++)
                                {
                                    if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]) == DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HMaterID"]) && DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HQty"]) == DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HQty"]) && DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HBatchNo"]) == DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HBatchNo"]))
                                    {
                                        oCn.RollBack();
                                        objJsonResult.code = "0";
                                        objJsonResult.count = 0;
                                        objJsonResult.Message = "同一单据号中已扫过信息相同的条码";
                                        objJsonResult.data = null;
                                        return objJsonResult;
                                    }
                                }
                            }
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "同一单据号中已扫过信息相同的条码";
                            objJsonResult.data = null;
                            return objJsonResult;
                            //for (var i = 0; i < ds.Tables[0].Rows.Count; i++)
                            //{
                            //    for (var j = i + 1; j < ds.Tables[0].Rows.Count; j++)
                            //    {
                            //        if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]) == DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HMaterID"]) && DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HQty"]) == DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HQty"]) && DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HBatchNo"]) == DBUtility.ClsPub.isLong(ds.Tables[0].Rows[j]["HBatchNo"]))
                            //        {
                            //            objJsonResult.code = "0";
                            //            objJsonResult.count = 0;
                            //            objJsonResult.Message = "同一单据号中已扫过信息相同的条码";
                            //            objJsonResult.data = null;
                            //            return objJsonResult;
                            //        }
                            //    }
                            //}
                        }
                    }
                    oCn.Commit();//提交事物
                    WebSoBar = oWebs.get_BarCode(sJXCode, HInterID, HBillType, HBillNo, HMaker, HWhID, HSPID, HQty, HRedBlueFlag, SourceFlag, HSourceBillNo, HSourceBillType, HStockOrgID, HScanStyle, HCustom1, HCustom2, ref DBUtility.ClsPub.sErrInfo);
                    if (WebSoBar == null)
                    {
                        objJsonResult.code = "0";