| | |
| | | //主表 |
| | | |
| | | 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; |
| | | } |
| | | //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 + ""); |
| | | LogService.Write($"6.1,用时" + sw.Elapsed); |
| | |
| | | } |
| | | sw.Stop();//结束计时 |
| | | LogService.Write($"11.参数查询结束,新增结束,用时" + sw.Elapsed); |
| | | LogService.Write("END--出站单据保存结束,出站单号:" + HBillNo); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "新增单据成功!"; |
| | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("出站单据保存发生异常,出站单号:" + sArray[0].ToString()); |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | |
| | | |
| | | oCn.BeginTran(); |
| | | |
| | | ds = oCn.RunProcReturn($"select * from Sc_AssemblyBillMain where HMainSourceInterID={oBill.omodel.HProcExchInterID} and HMainSourceEntryID={oBill.omodel.HProcExchEntryID} and HBarCode_P='{HBardcode}'", "Sc_AssemblyBillMain"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | oCn.RunProc($"delete from Sc_AssemblyBillMain where HMainSourceInterID={oBill.omodel.HProcExchInterID} and HMainSourceEntryID={oBill.omodel.HProcExchEntryID} and HBarCode_P='{HBardcode}'"); |
| | | oCn.RunProc($"delete from Sc_AssemblyBillMain where HInterID={ds.Tables[0].Rows[0]["HInterID"].ToString()} and HBarCode_P='{HBardcode}'"); |
| | | } |
| | | |
| | | oCn.RunProc("delete from Sc_StationOutBillSub_SN where HInterID=" + HInterID + " and HBarCode='" + HBardcode + "'"); |
| | | oCn.RunProc("update Sc_StationOutBillMain set HQty-=1 where HInterID=" + HInterID); |
| | | |
| | | |
| | | oCn.Commit(); |
| | | |
| | |
| | | { |
| | | } |
| | | |
| | | 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(); |
| | |
| | | #region 当前工单(扫码汇报) 条码查询 |
| | | [Route("Cj_StationOutBill_CurrentWork/SNHBardCodeList")] |
| | | [HttpGet] |
| | | public object SNHBardCodeList(string HBarCode, string user, int HOrgID) |
| | | public object SNHBardCodeList(string HBarCode, string HProcID, int HOrgID) |
| | | { |
| | | try |
| | | { |
| | | DataSet dataSet = null; |
| | | var num = 0; |
| | | ds = oCN.RunProcReturn(@"select HSourceInterID,HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); |
| | | |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | string HSourceInterID = ds.Tables[0].Rows[0]["HSourceInterID"].ToString(); |
| | | string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString(); |
| | | num = 1; |
| | | dataSet = ds; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from gy_czygl WITH(NOLOCK) where czymc='" + user + "'", "gy_czygl"); |
| | | string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); |
| | | ds = oCN.RunProcReturn(@"select HInterID,HBillNo from Sc_ProcessExchangeBillMain WITH(NOLOCK) where HBillNo='" + HBarCode + "'", "Sc_ProcessExchangeBillMain"); |
| | | if (ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | num = 2; |
| | | dataSet = ds; |
| | | } |
| | | |
| | | if (num == 1) |
| | | { |
| | | string HSourceInterID = dataSet.Tables[0].Rows[0]["HSourceInterID"].ToString(); |
| | | string HSourceBillNo = dataSet.Tables[0].Rows[0]["HSourceBillNo"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where hmainid=" + HSourceInterID + " and 单据号='" + HSourceBillNo + "' and HProcID=" + HProcID, "h_v_Sc_ProcessExchangeBillList"); |
| | | |
| | |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | else { |
| | | else if (num == 2) |
| | | { |
| | | string HSourceInterID = dataSet.Tables[0].Rows[0]["HInterID"].ToString(); |
| | | string HSourceBillNo = dataSet.Tables[0].Rows[0]["HBillNo"].ToString(); |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where hmainid=" + HSourceInterID + " and 单据号='" + HSourceBillNo + "' and HProcID=" + HProcID, "h_v_Sc_ProcessExchangeBillList"); |
| | | |
| | | if (ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条码:" + HBarCode + ",流转卡:" + HSourceBillNo + ",与当前流转卡,所对应的工序不存在!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条码查无数据!"; |