From 4318d57f8ba38c5c3b52a2f9d9972e158c08270c Mon Sep 17 00:00:00 2001 From: yangle <admin@YINMOU> Date: 星期五, 18 三月 2022 11:03:52 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/生产管理/生产任务单/Sc_ICMOBillController.cs | 142 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 142 insertions(+), 0 deletions(-) diff --git "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" index 5877890..0a6c7a5 100644 --- "a/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" +++ "b/WebAPI/Controllers/\347\224\237\344\272\247\347\256\241\347\220\206/\347\224\237\344\272\247\344\273\273\345\212\241\345\215\225/Sc_ICMOBillController.cs" @@ -76,7 +76,149 @@ #endregion + #region 澧欏挃瑁呯鍗曞洖杞︿簨浠� + [Route("Sc_ICMOBill/QK_PackingBillByXSBill")] + [HttpGet] + public object QK_PackingBillByXSBill(string HBillNo) + { + try + { + string sql = string.Format(@"select b.HMaterID,m.HNumber HMaterCode,m.HName HMaterName,b.HUnitID,u.HName HUnitName, + b.HQty HQty,a.HAddress HAddress,b.HDate HDate,b.HOutStockQty HOutStockQty,b.HInvoiceQty HInvoiceQty, + b.HTaxPrice HTaxPrice,b.HPrice HPrice,b.HMoney HMoney,a.HCusID HCusID,c.HName HCusName,a.HEmpID,e.HName HEmpName, + i.HInterID,i.HBillNo + from Xs_SeOrderBillMain a + left join Xs_SeOrderBillSub b on a.HInterID=b.HInterID + left join Gy_Material m on b.HMaterID=m.HItemID + left join Gy_Unit u on b.HUnitID=u.HItemID + left join Gy_Customer c on a.HCusID=c.HItemID + left join Gy_Employee e on a.HEmpID=e.HItemID + left join Sc_ICMOBillMain i on i.HSeOrderInterID=a.HInterID + where a.HInterID=(select HSeOrderInterID from Sc_ICMOBillMain where HBillNo='" + HBillNo + "')"); + + ds = oCN.RunProcReturn(sql, "Xs_SeOrderBillMain"); + if (ds.Tables[0].Rows.Count != 0 || ds != null) + { + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鑾峰彇鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鏆傛棤瀵瑰簲鐨勯攢鍞槑缁嗭紒"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + catch (Exception e) + { + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鑾峰彇澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion + #region 澧欏挃瑁呯鍗曟暣绠辩敓鎴� + [Route("Sc_ICMOBill/QK_PackingBillSavePack")] + [HttpPost] + public object QK_PackingBillSavePack([FromBody] JObject msg) + { + var _value = msg["msg"].ToString(); + string msg1 = _value.ToString(); + string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); + string msg2 = sArray[0].ToString(); + string msg3 = sArray[1].ToString(); + string msg4 = sArray[2].ToString(); + ListModels oListModels = new ListModels(); + try + { + if (msg4=="ZZ") + { + //琛ㄤ綋鏁版嵁 + //鎸� },{鏉ユ媶鍒嗘暟缁� //鍘绘帀銆愬拰銆� + + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Models.ClsQK_PackingBill> ls = new List<Models.ClsQK_PackingBill>(); + ls = oListModels.getObjectByJson_QK_PackingBill(msg2); + oCN.BeginTran(); + foreach (Models.ClsQK_PackingBill oItemSub in ls) + { + var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo); + var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true); + string sql = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID, + HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan, + HICMOInterID,HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight, + HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType) + values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," + + "'鑷姩缁戝畾','','', " + msg3 + ",getdate(),'','',0,''," + + oItemSub.HInterID + ",'" + oItemSub.HBillNo + "','" + HBillNo + "'," + oItemSub.HMaterID + "," + oItemSub.HUnitID + "," + oItemSub.HWeight + "," + oItemSub.HMWeight + "," + oItemSub.HPWeight + "," + + "0,0," + oItemSub.HEmpID + ",0,0,'','','')"); + oCN.RunProc(sql); + } + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鏁磋鐢熸垚鎴愬姛锛�"; + objJsonResult.data = ds.Tables[0]; + return objJsonResult; + } + else + { + msg2 = msg2.Replace("\\", ""); + msg2 = msg2.Replace("\n", ""); //\n + //msg2 = msg2.Replace("'", "鈥�"); + List<Models.ClsQK_PackingBill> ls = new List<Models.ClsQK_PackingBill>(); + ls = oListModels.getObjectByJson_QK_PackingBill(msg2); + + var HInterID = DBUtility.ClsPub.CreateBillID("3783", ref DBUtility.ClsPub.sExeReturnInfo); + var HBillNo = DBUtility.ClsPub.CreateBillCode("3783", ref DBUtility.ClsPub.sExeReturnInfo, true); + oCN.BeginTran(); + foreach (Models.ClsQK_PackingBill oItemSub in ls) + { + string sql = string.Format(@"insert into Sc_PackUnionBillSub(HInterID,HEntryID,HCloseMan,HCloseType,HRemark, + HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType, + HRelationQty,HRelationMoney,HMaterID,HUnitID,HQty,HSourceID,HEquipID,HGroupID,HWorkerID, + HScanDate,HBarCode,HBarCode_Pack) + values("+HInterID+",'','',0,'鑷姩缁戝畾',"+oItemSub.HInterID+",'',"+oItemSub.HBillNo+",'3710',"+ + "0,0,"+ oItemSub.HMaterID+","+ oItemSub.HUnitID+","+ oItemSub.HQty+", 0,0,0,0,"+ + "getdate(),'',"+HBillNo+")"); + oCN.RunProc(sql); + } + string sql2 = string.Format(@"Insert Sc_PackUnionBillMain(HYear,HPeriod,HBillType,HInterID,HDate,HBillNo,HBillStatus,HCheckItemNowID,HCheckItemNextID, + HRemark,HBacker,HChecker,HMaker,HMakeDate,HUpDater,HCloseMan,HCloseType,HDeleteMan,HICMOInterID,HICMOBillNo, + HBarCode_Pack,HMaterID,HUnitID,HWeight,HMWeight,HPWeight, + HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo,HBillSubType) + values('2022',1,'3783'," + HInterID + ",getdate(),'" + HBillNo + "',1,0,0," + + "'鑷姩缁戝畾','','', " + msg3 + ",getdate(),'','',0,'',0,0,'" + + HBillNo + "',0,0,0,0,0" + + "0,0,0,0,0,'','','')"); + oCN.RunProc(sql2); + oCN.Commit(); + objJsonResult.code = "1"; + objJsonResult.count = 1; + objJsonResult.Message = "鎷艰鐢熸垚鎴愬姛"; + objJsonResult.data = null; + return objJsonResult; + } + + } + catch (Exception e) + { + oCN.RollBack(); + objJsonResult.code = "0"; + objJsonResult.count = 0; + objJsonResult.Message = "鑾峰彇澶辫触锛�" + e.ToString(); + objJsonResult.data = null; + return objJsonResult; + } + } + #endregion } } \ No newline at end of file -- Gitblit v1.9.1