|  |  |  | 
|---|
|  |  |  | double HWasterQty_Mater = list[0].HWasterQty_Mater;//料废数量 | 
|---|
|  |  |  | double HBackWorkQty = list[0].HBackWorkQty;//返工数量 | 
|---|
|  |  |  | Int64 HShiftsID = list[0].HShiftsID;//生产班次 | 
|---|
|  |  |  | double HToCheckQty = list[0].HToCheckQty;//取样数量 | 
|---|
|  |  |  | double HLossQty = list[0].HLossQty;//遗失数量 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LogService.Write($"1.字段赋值,用时" + sw.Elapsed ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | if (oSystemParameter.ShowBill(ref Ret)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //判断客户不为龙山汽配 | 
|---|
|  |  |  | if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配"&& oSystemParameter.omodel.WMS_CampanyName != "瑞与祺") //系统参数 | 
|---|
|  |  |  | if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配" && oSystemParameter.omodel.WMS_CampanyName != "瑞与祺") //系统参数 | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (HSourceID == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | objJsonResult.Message = "生产资源没有选择!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //判断客户为龙山汽配 | 
|---|
|  |  |  | else if (oSystemParameter.omodel.WMS_CampanyName == "龙山汽配") | 
|---|
|  |  |  | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //判断客户为斯莫尔 | 
|---|
|  |  |  | else if (oSystemParameter.omodel.WMS_CampanyName == "杭州斯莫尔") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (HQty + HWasterQty + HBadCount <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "合格数量加报废数量加不良数量不能为0!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else { | 
|---|
|  |  |  | if (HQty + HWasterQty <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "合格数量加报废数量不能为0!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //if (HCenterID == 0) | 
|---|
|  |  |  | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | if (HQty + HWasterQty <= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "合格数量加报废数量不能为0!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //if (HWorkTimes <= 0) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | 
|---|
|  |  |  | ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + | 
|---|
|  |  |  | ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" + | 
|---|
|  |  |  | ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID,HWasterQty_Work,HWasterQty_Mater,HBackWorkQty,HShiftsID" + | 
|---|
|  |  |  | ",HToCheckQty,HLossQty" + | 
|---|
|  |  |  | ") " + | 
|---|
|  |  |  | " values('" + BillType + "','" + (OperationType == "5" ? "SUB" : HBillSubType)  + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + | 
|---|
|  |  |  | "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + | 
|---|
|  |  |  | 
|---|
|  |  |  | "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" + | 
|---|
|  |  |  | "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + | 
|---|
|  |  |  | "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID + | 
|---|
|  |  |  | ","+ HmaterOutqty + "," + HProcPriceRate + ","+ HTemporaryAreaID + "," + HWasterQty_Work + "," + HWasterQty_Mater + "," + HBackWorkQty + | 
|---|
|  |  |  | "," + HShiftsID + ") "); | 
|---|
|  |  |  | "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + "," + HWasterQty_Work + "," + HWasterQty_Mater + "," + HBackWorkQty + | 
|---|
|  |  |  | "," + HShiftsID + "," + HToCheckQty + "," + HLossQty + ") "); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LogService.Write($"4.新增结束,用时" + sw.Elapsed); | 
|---|
|  |  |  | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增工序出站单据:" + HBillNo); | 
|---|
|  |  |  | 
|---|
|  |  |  | ",HWorkTimes=" + HWorkTimes + | 
|---|
|  |  |  | ",HSaveBillFlag=0 " + | 
|---|
|  |  |  | ",HPieceQty=" + HPieceQty + | 
|---|
|  |  |  | ",HToCheckQty=" + HToCheckQty + | 
|---|
|  |  |  | ",HLossQty=" + HLossQty + | 
|---|
|  |  |  | ",HQty=" + HQty + | 
|---|
|  |  |  | ",HDSQty=" + HDSQty + | 
|---|
|  |  |  | ",HChongQty=" + HChongQty + | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //主表 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LogService.Write($"5.系统控制查询判断,用时" + sw.Elapsed); | 
|---|
|  |  |  | ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl"); | 
|---|
|  |  |  | if (ds == null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "判断数量失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LogService.Write($"5.1,用时" + sw.Elapsed); | 
|---|
|  |  |  | if (ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "判断数量失败!"; | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | LogService.Write($"5.2,用时" + sw.Elapsed); | 
|---|
|  |  |  | if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | objJsonResult.code = "0"; | 
|---|
|  |  |  | objJsonResult.count = 0; | 
|---|
|  |  |  | objJsonResult.Message = "数量控制," + ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); | 
|---|
|  |  |  | objJsonResult.data = null; | 
|---|
|  |  |  | return objJsonResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //LogService.Write($"5.系统控制查询判断,用时" + sw.Elapsed); | 
|---|
|  |  |  | //ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl"); | 
|---|
|  |  |  | //if (ds == null) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    oCN.RollBack(); | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "判断数量失败!"; | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //LogService.Write($"5.1,用时" + sw.Elapsed); | 
|---|
|  |  |  | //if (ds.Tables[0].Rows.Count == 0) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    oCN.RollBack(); | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "判断数量失败!"; | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | //LogService.Write($"5.2,用时" + sw.Elapsed); | 
|---|
|  |  |  | //if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    oCN.RollBack(); | 
|---|
|  |  |  | //    objJsonResult.code = "0"; | 
|---|
|  |  |  | //    objJsonResult.count = 0; | 
|---|
|  |  |  | //    objJsonResult.Message = "数量控制," + ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); | 
|---|
|  |  |  | //    objJsonResult.data = null; | 
|---|
|  |  |  | //    return objJsonResult; | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | LogService.Write($"6.判断结束,用时" + sw.Elapsed); | 
|---|
|  |  |  | oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + ","+ num + ""); | 
|---|
|  |  |  | oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + "," + num + ""); | 
|---|
|  |  |  | LogService.Write($"6.1,用时" + sw.Elapsed); | 
|---|
|  |  |  | oCN.RunProc("exec h_p_Mes_ProcessExchangeChangeStatus  " + HInterID + " "); | 
|---|
|  |  |  | LogService.Write($"6.2,用时" + sw.Elapsed); | 
|---|
|  |  |  | oCN.RunProc("exec h_p_Mes_StationOutBillBackBarCode  " + HInterID + " "); | 
|---|
|  |  |  | LogService.Write($"7.存储过程结束,用时" + sw.Elapsed); | 
|---|
|  |  |  | //判断是否是 末道工序 | 
|---|
|  |  |  | //判断是否是 末道工序 | 
|---|
|  |  |  | ds1 = oCN.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a  " + | 
|---|
|  |  |  | " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID  " + | 
|---|
|  |  |  | " Where a.HInterID=" + HProcExchInterID + " and b.HEntryID=" + HProcExchEntryID + " ", "Sc_ProcessExchangeBillMain"); | 
|---|
|  |  |  | 
|---|
|  |  |  | { | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | DataSet dataSet = oCN.RunProcReturn(@"select a.HProcExchBillNo,a.HQty,b.HQty HProcExchQty  from Sc_StationOutBillMain a | 
|---|
|  |  |  | inner join Sc_ProcessExchangeBillMain b on a.HProcExchInterID = b.HInterID | 
|---|
|  |  |  | where a.HInterID = " + lngBillKey, "Sc_ProcessExchangeBillMain"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (dataSet.Tables[0].Rows.Count > 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string HProcExchBillNo = dataSet.Tables[0].Rows[0]["HProcExchBillNo"].ToString(); | 
|---|
|  |  |  | double HQty = double.Parse(dataSet.Tables[0].Rows[0]["HQty"].ToString()); | 
|---|
|  |  |  | double HProcExchQty = double.Parse(dataSet.Tables[0].Rows[0]["HProcExchQty"].ToString()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | LogService.Write("出站单据审核更改流转卡数量,流转卡:" + HProcExchBillNo + ",出站单号:" + HBillNo + ",原流转卡数量:" + HProcExchQty + ",新流转卡数量:" + HQty); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //审核后控制 | 
|---|
|  |  |  | string sql = "exec h_p_Sc_StationOutBill_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'"; | 
|---|
|  |  |  | ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_AfterCheckCtrl"); | 
|---|
|  |  |  | 
|---|
|  |  |  | oCN.RollBack(); | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | sReturn = sReturn + " 审核功能!"; | 
|---|
|  |  |  | oCN.Commit(); | 
|---|