| | |
| | | long HEmpID = mainList[0].HEmpID;//ä¸å¡å |
| | | long HCusID = mainList[0].HCusID;//å®¢æ· |
| | | long HCenterID = mainList[0].HCenterID;//å·¥ä½ä¸å¿ |
| | | double? HPlanQty = mainList[0].HPlanQty==null?0: mainList[0].HPlanQty;//è®¡åæ°é |
| | | double? HPlanQty = mainList[0].HPlanQty == null ? 0 : mainList[0].HPlanQty;//è®¡åæ°é |
| | | string HMaker = user;//å¶å人 |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_ICMOBillList where hmainid=" + HInterID + " and åæ®å·='" + HBillNo + "'", "h_v_IF_ICMOBillList"); |
| | |
| | | ,HYear,HPeriod,HRemark,HMaker,HMakeDate |
| | | ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID |
| | | ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate) |
| | | values('3710'," + HInterID + ",'" + HBillNo + "','" + HDate + "',"+ HPRDORGID + |
| | | "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()"+ |
| | | ",'"+ HSeOrderBillNo+"',"+ HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID+ |
| | | ","+ HCenterID+ "," + HPlanQty+ ",0,0,0,0,'','') "); |
| | | values('3710'," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID + |
| | | "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" + |
| | | ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID + |
| | | "," + HCenterID + "," + HPlanQty + ",0,0,0,0,'','') "); |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { //ä¿®æ¹ |
| | | oCN.RunProc("update Sc_ICMOBillMain set " + |
| | | "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + |
| | | ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + "" + |
| | | ", HCenterID=" + HCenterID + ", HPlanQty=" + HPlanQty + " where HInterID="+ HInterID); |
| | | ", HCenterID=" + HCenterID + ", HPlanQty=" + HPlanQty + " where HInterID=" + HInterID); |
| | | |
| | | //å é¤å表 |
| | | oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "'"); |
| | |
| | | foreach (ClsSc_ICMOBillSub oSub in DetailColl) |
| | | { |
| | | i++; |
| | | if (oSub.HQty <= 0||oSub.HQty==null) |
| | | if (oSub.HQty <= 0 || oSub.HQty == null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | ,HBeginDate,HEndDate |
| | | ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS |
| | | ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) |
| | | values({HInterID},{i},{(oSub.HQty==null?0:oSub.HQty)} |
| | | values({HInterID},{i},{(oSub.HQty == null ? 0 : oSub.HQty)} |
| | | ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}' |
| | | ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}' |
| | | ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS} |
| | |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | [Route("Sc_ICMOBill/ICMOBillSaveApi")] |
| | | [HttpPost] |
| | | public object ICMOBillSaveApi([FromBody] JObject sMainSub) |
| | | { |
| | | try |
| | | { |
| | | var model = sMainSub["model"].ToString(); |
| | | var entry = sMainSub["model"]["HENTRY"].ToString(); |
| | | |
| | | model = "[" + model.ToString() + "]"; |
| | | List<ClsSc_ICMOBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ICMOBillMain>>(model); |
| | | List<ClsSc_ICMOBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<ClsSc_ICMOBillSub>>(entry); |
| | | string sql = string.Empty; |
| | | oCN.BeginTran(); |
| | | sql = $"delete Sc_ICMOBillMain where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | sql = $"delete Sc_ICMOBillSub where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | //主表 |
| | | oCN.RunProc(@"Insert Into Sc_ICMOBillMain |
| | | (HBillType,HInterID,HBillNo,HDate,HPRDORGID |
| | | ,HYear,HPeriod,HRemark,HMaker,HMakeDate |
| | | ,HSeOrderBillNo,HSeOrderInterID,HSeOrderEntryID,HEmpID,HCusID |
| | | ,HCenterID,HPlanQty,HDeptID,HMaterID,HUnitID,HBomID,HPlanBeginDate,HPlanEndDate) |
| | | values('3710'," + mainList[0].HInterID + ",'" + mainList[0].HBillNo + "','" + mainList[0].HDate + "'," + mainList[0].HPRDORGID + |
| | | "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + mainList[0].HRemark + "','" + mainList[0].HMaker + "',getdate()" + |
| | | ",'" + mainList[0].HSeOrderBillNo + "'," + mainList[0].HSeOrderInterID + "," + mainList[0].HSeOrderEntryID + "," + mainList[0].HEmpID + "," + mainList[0].HCusID + |
| | | "," + mainList[0].HCenterID + "," + mainList[0].HPlanQty + ",0,0,0,0,'','') "); |
| | | //ä¿å主表 |
| | | foreach (var oSub in subList) |
| | | { |
| | | oCN.RunProc($@"Insert into Sc_ICMOBillSub |
| | | (HInterID,HENTRYID,HQty |
| | | ,HPlanBeginDate,HPlanEndDate |
| | | ,HBeginDate,HEndDate |
| | | ,HMaterID,HUnitID,HRemark,HSourceID,HDeptID,HSTATUS |
| | | ,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) |
| | | values({oSub.HInterID},{oSub.HEntryID},{(oSub.HQty == null ? 0 : oSub.HQty)} |
| | | ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}' |
| | | ,'{(oSub.HPlanBeginDate == null ? DateTime.Now.ToString("yyyy-MM-dd") : oSub.HPlanBeginDate.ToString())}','{(oSub.HPlanEndDate == null ? DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") : oSub.HPlanEndDate.ToString())}' |
| | | ,{oSub.HMaterID},{oSub.HUnitID},'{oSub.HRemark}',{oSub.HSourceID},{oSub.HDeptID},{oSub.HSTATUS} |
| | | ,0,0,'','',0,0)"); |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | | |
| | | |
| | | #region ç产任å¡å(æ å表) ä¿å/ç¼è¾åè½ |
| | | [Route("Sc_ICMOBill/ICMOBillEdit_NoTable")] |
| | |
| | | values('3710'," + HInterID + ",'" + HBillNo + "','" + HDate + "'," + HPRDORGID + |
| | | "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + HRemark + "','" + HMaker + "',getdate()" + |
| | | ",'" + HSeOrderBillNo + "'," + HSeOrderInterID + "," + HSeOrderEntryID + "," + HEmpID + "," + HCusID + |
| | | "," + HCenterID + ",0,0,0,0,"+ HBomID + ",'','') "); |
| | | "," + HCenterID + ",0,0,0,0," + HBomID + ",'','') "); |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { //ä¿®æ¹ |
| | | oCN.RunProc("update Sc_ICMOBillMain set " + |
| | | "HRemark='" + HRemark + "', HChecker='" + HMaker + "', HCheckDate=getdate()" + |
| | | ", HSeOrderBillNo='" + HSeOrderBillNo + "', HSeOrderInterID=" + HSeOrderInterID + ", HSeOrderEntryID=" + HSeOrderEntryID + ", HEmpID=" + HEmpID + ", HCusID=" + HCusID + "" + |
| | | ", HCenterID=" + HCenterID + ",HBomID="+ HBomID + " where HInterID=" + HInterID); |
| | | ", HCenterID=" + HCenterID + ",HBomID=" + HBomID + " where HInterID=" + HInterID); |
| | | |
| | | //å é¤å表 |
| | | oCN.RunProc("delete from Sc_ICMOBillSub where HInterID='" + HInterID + "'"); |
| | |
| | | int LSH; |
| | | string LSH2; |
| | | string TM = ""; |
| | | int XH = Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString() == ""? 0 : Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString())); |
| | | int XH = Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString() == "" ? 0 : Convert.ToInt32(d.Tables[0].Rows[0]["HRemark"].ToString())); |
| | | |
| | | foreach (Models.ClsQK_PackingBill oItemSub in ls) |
| | | { |
| | |
| | | |
| | | if (msg6 == "ZZ") |
| | | { |
| | | XH = XH +1; |
| | | XH = XH + 1; |
| | | } |
| | | else if (msg6 == "PZ"&& ls.IndexOf(oItemSub) == 0) |
| | | else if (msg6 == "PZ" && ls.IndexOf(oItemSub) == 0) |
| | | { |
| | | XH = XH + 1; |
| | | } |
| | |
| | | ",HSTOCKORGID,HOWNERID,HSeOrderBillNo,HInterID " + |
| | | ",HGiveAwayFlag " + |
| | | ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo,HInnerBillNo " + |
| | | ") values ("+i |
| | | ") values (" + i |
| | | + ",'" + TM + "','å¯ä¸æ¡ç '," + oItemSub.HMaterID.ToString() + "," + oItemSub.HUnitID.ToString() + "," + oItemSub.HMinQty.ToString() |
| | | + ",'',0,0,'" + msg3 + "',getdate(),0," + oItemSub.HMinQty.ToString() |
| | | + ", " + oItemSub.HInterID.ToString() + "," + oItemSub.HEntryID.ToString() + ",'" + oItemSub.HBillNo + "','3710',''" |
| | | + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,'"+ XH + "'" |
| | | + ",1,1," + oItemSub.HDeptID.ToString() + ",0,0,'" + XH + "'" |
| | | + ", " + oItemSub.HCusID.ToString() + ",'',getdate(),'',getdate()" |
| | | + ", " + msg5.ToString() + "," + OrgNum.ToString() + ",'" + oItemSub.HSeOrderBillNo.ToString() + "'," + HInterID.ToString() |
| | | + ",0" |
| | | + ",'" + oItemSub.HMaterName + "','','',0,'','')"); |
| | | |
| | | |
| | | oCN.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'"); |
| | | |
| | | |
| | | } |
| | | oCN.RunProc("update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HEntryID=" + oItemSub.HEntryID); |
| | | oCN.RunProc("update Sc_PPBomBillMain set HRemark=" +XH+ " where HBillNo='" + msg7+"'"); |
| | | oCN.RunProc("update Sc_ICMOBillSub set HQty=" + oItemSub.HSpsQty + " where HEntryID=" + oItemSub.HEntryID); |
| | | oCN.RunProc("update Sc_PPBomBillMain set HRemark=" + XH + " where HBillNo='" + msg7 + "'"); |
| | | DataSet Dsn = oCN.RunProcReturn("select top " + oItemSub.HTotalQty + " HItemID from Gy_BarCodeBill order by HItemID desc", "Gy_BarCodeBill"); //è·åæå¤§æµæ°´å· |
| | | for (int i = 0; i < oItemSub.HTotalQty; i++) |
| | | { |
| | |
| | | else |
| | | { |
| | | //éè¿æ¡ç idæ¾å°ææ¡ç ï¼éè¿ææ¡ç æ¾å°ç»æåå表ä¸çå¯ä¸ç |
| | | string sql2 = "select HBarCode from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=" + HInterID+")"; |
| | | string sql2 = "select HBarCode from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=" + HInterID + ")"; |
| | | //string sql2 = "select HBarCode from Sc_PackUnionBillSub where HInterID=(select HBarcodeNo from Gy_BarCodeBill where HItemID=3250)"; |
| | | DataSet ds1 = oCN.RunProcReturn(sql2, "Sc_PackUnionBillSub"); |
| | | DataTable dt = ds1.Tables[0]; |
| | |
| | | |
| | | string sql = string.Format(@"delete from Gy_BarCodeBill where HBarCode='" + dr["HBarCode"].ToString() + "'"); |
| | | string sql1 = string.Format(@"update Sc_ICMOBillSub set HQty=HQty+" + dr1["HQty"] + " where HEntryID=(select HSourceEntryID from Gy_BarCodeBill where HBarCode='" + dr["HBarCode"].ToString() + "')"); |
| | | oCN.RunProc(sql1); |
| | | oCN.RunProc(sql1); |
| | | oCN.RunProc(sql); |
| | | } |
| | | } |