| | |
| | | public bool TempList_Modify(Int64 sHInterID, string sHBillNo, string sHBillType, ref string sErrMsg) |
| | | { |
| | | SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | string sFIFOCtl = "N"; //先进先出控制('Y'为控制) |
| | | |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | if (oSystemParameter.ShowBill(ref sErrMsg) == false) |
| | | { |
| | | sErrMsg = "单据号:" + sHBillNo + ",单据ID:" + sHInterID + ";点击编辑时获取系统参数失败! " + sErrMsg; |
| | | return false; |
| | | } |
| | | |
| | | //判断是否启用先进先出管理(Y,N) |
| | | if (sHBillType == "1204" && (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MateOutBill_FIFOList == "Y")) //生产领料单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | | else if (sHBillType == "1205" && (oSystemParameter.omodel.Kf_SellOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_SellOutBill_FIFOList == "Y")) //销售出库单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | | else if (sHBillType == "1211" && (oSystemParameter.omodel.Kf_EntrustOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_EntrustOutBill_FIFOList == "Y")) //委外出库单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | | else if (sHBillType == "1207" && (oSystemParameter.omodel.Kf_MoveStockBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MoveStockBill_FIFOList == "Y")) //直接调拨单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | | else if (sHBillType == "1250" && (oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOCtl == "Y" || oSystemParameter.omodel.Kf_MoveStockStepOutBill_FIFOList == "Y")) //分步式调出单-先进先出控制 |
| | | { |
| | | sFIFOCtl = "Y"; |
| | | } |
| | | |
| | | try |
| | | { |
| | | oCn.BeginTran(); |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_TempList_Modify " + sHInterID + ",'" + sHBillNo + "','" + sHBillType + "'", "h_p_WMS_TempList_Modify"); |
| | | DataSet Ds = oCn.RunProcReturn("exec h_p_WMS_TempList_Modify " + sHInterID + ",'" + sHBillNo + "','" + sHBillType + "','" + sFIFOCtl + "'", "h_p_WMS_TempList_Modify"); |
| | | if (Ds == null || Ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "缓存列表编辑前判断失败,数据库连接失败!"; |
| | |
| | | //先进先出控制 |
| | | if (oSystemParameter.omodel.Kf_MateOutBill_FIFOCtl == "Y") //系统参数 生产领料单-先进先出控制 |
| | | { |
| | | DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HPTQty.ToString() + "," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFO_MateOut"); |
| | | DataSet FIFO = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFO_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HPTQty.ToString() + "," + HFIFOWhID.ToString() + "," + HOWNERID.ToString(), "h_p_WMS_AddSourceFIFO_MateOut"); |
| | | if (FIFO == null || FIFO.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";存入先进先出临时表失败!"; |
| | |
| | | //先进先出下架清单 |
| | | else if (oSystemParameter.omodel.Kf_MateOutBill_FIFOList == "Y") //系统参数 生产领料单-先进先出下架清单 |
| | | { |
| | | DataSet FIFOList = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFOList_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HPTQty.ToString() + "," + HFIFOWhID.ToString(), "h_p_WMS_AddSourceFIFOList_MateOut"); |
| | | DataSet FIFOList = oCn.RunProcReturn("exec h_p_WMS_AddSourceFIFOList_MateOut " + HInterID.ToString() + ",'" + HBillType + "','" + HSourceBillNo + "','" + HSourceBillType + "'," + HPTQty.ToString() + "," + HFIFOWhID.ToString() + "," + HOWNERID.ToString(), "h_p_WMS_AddSourceFIFOList_MateOut"); |
| | | if (FIFOList == null || FIFOList.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "单据号:" + HBillNo + ",单据ID:" + HInterID + ";存入先进先出下架清单失败!"; |
| | |
| | | } |
| | | |
| | | //1、首次扫码防串单判断; 2、源单类型是否在源单列表里判断; 3、唯一条码是否存在相同条码判断; 4、有源单,物料是否在源单中判断 |
| | | DataSet dsSource = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_SourceInterID " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + omodel_View.HBarCode + "','" + HSourceBillType + "'," + DBUtility.ClsPub.BoolToString(SourceFlag) + "," + sSourceBillCtl + ",'" + sBatchNoCtl + "','" + sMultilineCtl + "','" + sMaterWHSPCtl + "','" + sSourceWHSPCtl + "'", "h_p_WMS_AddBarCode_SourceInterID"); |
| | | DataSet dsSource = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_SourceInterID " + HInterID.ToString() + ",'" + HBillNo + "','" + HBillType + "','" + omodel_View.HBarCode + "','" + HSourceBillType + "'," + HStockOrgID.ToString() + "," + DBUtility.ClsPub.BoolToString(SourceFlag) + "," + sSourceBillCtl + ",'" + sBatchNoCtl + "','" + sMultilineCtl + "','" + sMaterWHSPCtl + "','" + sSourceWHSPCtl + "'", "h_p_WMS_AddBarCode_SourceInterID"); |
| | | if (dsSource == null || dsSource.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断所扫条码是否在单据中发生错误!"; |
| | |
| | | //库存控制-WMS负库存控制 唯一条码、启用条码库存,仓库仓位获取顺序:界面上仓库仓位 > 条码库存仓库仓位 |
| | | if (omodel_View.HBarCodeType == "唯一条码" && oSystemParameterMain.WMS_WMSStockCtl == "Y") |
| | | { |
| | | //判断ERP库存 返回ERP库存数量 |
| | | DataSet DsWMS = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_GetWMSICInventory " + HInterID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString(), "h_p_WMS_AddBarCode_GetWMSICInventory"); |
| | | //判断条码库存 返回条码库存数量 |
| | | DataSet DsWMS = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_GetWMSICInventory " + HInterID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HWhID.ToString() + "," + HSPID.ToString() + "," + HStockOrgID.ToString(), "h_p_WMS_AddBarCode_GetWMSICInventory"); |
| | | if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "所扫描物料条码: " + omodel_View.HBarCode + " ,无条码库存!"; |
| | |
| | | //先进先出控制 |
| | | if (sFIFOCtl == "Y") |
| | | { |
| | | DataSet dsFIFO = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_BarCode " + HInterID.ToString() + ",'" + HBillType + "','" + oMain.HBatchNo + "','" + oMain.HBarCode + "'," + sRelQty.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_BarCode"); |
| | | DataSet dsFIFO = oCn.RunProcReturn("exec h_p_Kf_ICInventory_FIFO_Tmp_BarCode " + HInterID.ToString() + ",'" + HBillType + "','" + omodel_View.HBatchNo + "','" + omodel_View.HBarCode + "'," + sRelQty.ToString(), "h_p_Kf_ICInventory_FIFO_Tmp_BarCode"); |
| | | if (dsFIFO == null || dsFIFO.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "启用先进先出控制,所扫条码不在先进先出列表清单中!"; |
| | |
| | | oMain.HSubBillType = "1270"; |
| | | HCustom1 = ""; |
| | | } |
| | | //条码类型为唯一条码,扫码存入时 HRelationEntryID=1,用于判断刷新列表时区分是否重复扫入 |
| | | if (omodel_View.HBarCodeType == "唯一条码") |
| | | { |
| | | oMain.HRelationEntryID = 1; |
| | | } |
| | | oMain.HInterID = HInterID; |
| | | oMain.HBillNo = HBillNo; |
| | | oMain.HBillType = HBillType; |
| | |
| | | oMain.HSourceInterID = DBUtility.ClsPub.isLong(dsSource.Tables[0].Rows[i]["HSourceInterID"]); |
| | | oMain.HSourceEntryID = DBUtility.ClsPub.isLong(dsSource.Tables[0].Rows[i]["HSourceEntryID"]); |
| | | oMain.HSourceBillNo = DBUtility.ClsPub.isStrNull(dsSource.Tables[0].Rows[i]["HSourceBillNo"]); |
| | | oMain.HSourceBillType = HSourceBillType; |
| | | oMain.HSourceBillType = DBUtility.ClsPub.isStrNull(dsSource.Tables[0].Rows[i]["HSourceBillType"]); |
| | | oMain.HSTOCKORGID = HStockOrgID; |
| | | oMain.HOWNERID = HStockOrgID; |
| | | oMain.HCusBarCode = HCustom1; |