| | |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Data.SqlClient; |
| | | using System.Diagnostics; |
| | | using System.IO; |
| | | using System.Web; |
| | | using System.Web.Http; |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | Stopwatch sw = new Stopwatch(); |
| | | sw.Start();//开始计时 |
| | | |
| | | List<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2); |
| | | long HMainInterID = 0; |
| | |
| | | long HQCCheckID = list[0].HQCCheckID;//检验员ID |
| | | long HPRDOrgID = list[0].HPRDOrgID;//组织ID |
| | | double HmaterOutqty = list[0].HmaterOutqty;//白坯发布 |
| | | |
| | | LogService.Write($"1.字段赋值,用时" + sw.Elapsed ); |
| | | |
| | | //单据完整性判断 |
| | | if (HProcExchInterID <= 0) |
| | | { |
| | |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | //} |
| | | |
| | | LogService.Write($"2.条件判断,用时" + sw.Elapsed); |
| | | |
| | | var num = 0; |
| | | LogService.Write($"3.事务开始,用时" + sw.Elapsed); |
| | | |
| | | //若MAINDI重复则重新获取 |
| | | oCN.BeginTran(); |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.Write($"3.1,用时" + sw.Elapsed); |
| | | oCN.RunProc("Insert Into Sc_StationOutBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate,HMouldNum" + |
| | | ",HYear,HPeriod,HRemark,HSourceName,HPieceQty,HWasterQty,HPlanPieceQty,HBadPNL" + |
| | |
| | | "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID + |
| | | ","+ HmaterOutqty + ") "); |
| | | |
| | | LogService.Write($"4.新增结束,用时" + sw.Elapsed); |
| | | LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增工序出站单据:" + HBillNo); |
| | | oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "新增工序出站单据:" + HBillNo + "','LMES-工序出站模块','" + DBUtility.ClsPub.IPAddress + "','新增单据'", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | |
| | | } |
| | | //主表 |
| | | |
| | | LogService.Write($"5.系统控制查询判断,用时" + sw.Elapsed); |
| | | ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl"); |
| | | if (ds == null) |
| | | { |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.Write($"5.1,用时" + sw.Elapsed); |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | oCN.RollBack(); |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.Write($"5.2,用时" + sw.Elapsed); |
| | | if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") |
| | | { |
| | | oCN.RollBack(); |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.Write($"6.判断结束,用时" + sw.Elapsed); |
| | | 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 " + |
| | |
| | | //判断末道 生产汇报汇报 是否勾选 |
| | | if (oSystemParameter.omodel.MES_StationOutBill_LastAutoICMOReport == "Y") //系统参数 |
| | | { |
| | | LogService.Write($"7.1,用时" + sw.Elapsed); |
| | | //同步生产汇报单 |
| | | objJsonResult= (json)SaveICMOReportBill(HInterID.ToString(), user, HBillNo, HPRDOrgID.ToString()); |
| | | LogService.Write($"7.2,用时" + sw.Elapsed); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | oCN.RollBack(); |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.Write($"8.生产汇报结束,用时" + sw.Elapsed); |
| | | } |
| | | //判断末道 生产入库 是否勾选 |
| | | else if (oSystemParameter.omodel.MES_StationOutBill_AutoStockIn == "Y") //系统参数 |
| | | { |
| | | LogService.Write($"8.1,用时" + sw.Elapsed); |
| | | //同步生产入库单 |
| | | objJsonResult=(json)SaveProcdutInBill(HBillNo); |
| | | LogService.Write($"8.2,用时" + sw.Elapsed); |
| | | if (objJsonResult.count == 0) |
| | | { |
| | | oCN.RollBack(); |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | LogService.Write($"9.生产入库结束,用时" + sw.Elapsed); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | LogService.Write($"10.事务结束,用时" + sw.Elapsed); |
| | | oCN.Commit(); |
| | | string sReturn = ""; |
| | | if (oSystemParameter.ShowBill(ref sReturn) == true) |
| | |
| | | objJsonResult.Verify = "N"; |
| | | } |
| | | } |
| | | sw.Stop();//结束计时 |
| | | LogService.Write($"11.参数查询结束,新增结束,用时" + sw.Elapsed); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "新增单据成功!"; |