| | |
| | | DAL.ClsKF_PonderationBillMain_Temp_Ctl tem = new DAL.ClsKF_PonderationBillMain_Temp_Ctl(); |
| | | Model.ClsKF_PonderationBillMain_Temp oMain = new Model.ClsKF_PonderationBillMain_Temp(); |
| | | |
| | | string HMaterNumber; //物料代码 |
| | | string sSourceBillCtl = "N"; //是否进行源单信息核对('Y'为核对源单信息) |
| | | string sBatchNoCtl = "N"; //是否进行批号核对('Y'为核对批号) |
| | | string sMultilineCtl = "N"; //是否存在多行相同物料时自动拆分换行('Y'为自动拆分) |
| | |
| | | omodel_View.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceEntryID"]); |
| | | omodel_View.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSourceInterID"]); |
| | | omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HQtyMust"]); //源单可扫数量 |
| | | HMaterNumber = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HMaterNumber"]); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | double sWMSQty = 0; //条码库存数量 |
| | | double sERPQty = 0; //ERP库存数量 |
| | | string sWhName = ""; //仓库名称 |
| | | string sSPName = ""; //仓位名称 |
| | | if (omodel_View.HBarCodeType == "唯一条码") |
| | | { |
| | | //判断条码库存 库存控制-WMS负库存控制 |
| | | if (oSystemParameterMain.WMS_WMSStockCtl == "Y" && HBillType != "1251") |
| | | { |
| | | //判断ERP库存 返回ERP库存数量 |
| | | DataSet DsWMS = oCn.RunProcReturn("exec h_p_KF_ICInventory_WMS_GetWHAndSP " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString(), "h_p_KF_ICInventory_WMS_GetWHAndSP"); |
| | | //判断条码库存 返回条码库存数量 |
| | | DataSet DsWMS = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_GetWMSICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString() + "," + HStockOutOrgID.ToString(), "h_p_WMS_AddBarCode_GetWMSICInventory"); |
| | | if (DsWMS == null || DsWMS.Tables[0].Rows.Count == 0) |
| | | { |
| | | sRelQty = 0; |
| | | sErrMsg = "所扫描物料条码: " + omodel_View.HBarCode + " ,无条码库存!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | HSCWHID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HWhID"]); |
| | | HSCSPID = DBUtility.ClsPub.isLong(DsWMS.Tables[0].Rows[0]["HSPID"]); |
| | | sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HKFQty"]); |
| | | //判断扫描条码数量与条码库存数量 |
| | | if (sRelQty > sWMSQty) |
| | | sWMSQty = DBUtility.ClsPub.isDoule(DsWMS.Tables[0].Rows[0]["HQty"]); |
| | | sWhName = DBUtility.ClsPub.isStrNull(DsWMS.Tables[0].Rows[0]["HWhName"]); |
| | | sSPName = DBUtility.ClsPub.isStrNull(DsWMS.Tables[0].Rows[0]["HSPName"]); |
| | | |
| | | if (sWMSQty <= 0) |
| | | { |
| | | sErrMsg = "所扫描物料条码:" + omodel_View.HBarCode + " ,在仓库[ " + sWhName + " ]、仓位[ " + sSPName + " ]中,无条码库存!"; |
| | | return false; |
| | | } |
| | | //判断扫描数量与条码库存数量 |
| | | else if (sRelQty > sWMSQty) |
| | | { |
| | | sRelQty = sWMSQty; |
| | | } |
| | |
| | | if (oSystemParameterMain.WMS_ERPStockCtl == "Y" && HBillType != "1251") |
| | | { |
| | | //判断ERP库存 返回ERP库存数量 |
| | | DataSet DsERP = oCn.RunProcReturn("exec h_p_IF_CheckQtyByERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + omodel_View.HBarCode + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString() + "," + omodel_View.HMaterID.ToString() + "," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + sRelQty.ToString() + "," + HStockOutOrgID.ToString(), "h_p_IF_CheckQtyByERPICInventory"); |
| | | DataSet DsERP = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_GetERPICInventory " + HBillID.ToString() + ",'" + HBillType + "','" + HMaterNumber + "'," + omodel_View.HAuxPropID.ToString() + ",'" + omodel_View.HBatchNo + "'," + HSCWHID.ToString() + "," + HSCSPID.ToString() + "," + HStockOutOrgID.ToString(), "h_p_WMS_AddBarCode_GetERPICInventory"); |
| | | if (DsERP == null || DsERP.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断ERP库存,发生错误!"; |
| | | sErrMsg = "所扫描条码对应物料代码: " + HMaterNumber + " ,无金蝶库存!"; |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(DsERP.Tables[0].Rows[0][0]) == 0) |
| | | sERPQty = DBUtility.ClsPub.isDoule(DsERP.Tables[0].Rows[0]["HQty"]); |
| | | sWhName = DBUtility.ClsPub.isStrNull(DsERP.Tables[0].Rows[0]["HWhName"]); |
| | | sSPName = DBUtility.ClsPub.isStrNull(DsERP.Tables[0].Rows[0]["HSPName"]); |
| | | |
| | | if (sERPQty <= 0) |
| | | { |
| | | sERPQty = DBUtility.ClsPub.isDoule(DsERP.Tables[0].Rows[0]["HQty"]); |
| | | sRelQty = sERPQty; |
| | | } |
| | | else |
| | | { |
| | | sErrMsg = DBUtility.ClsPub.isStrNull(DsERP.Tables[0].Rows[0]["HRemark"]); |
| | | sErrMsg = "所扫描条码对应物料代码:" + HMaterNumber + " ,在仓库[ " + sWhName + " ]、仓位[ " + sSPName + " ]中,无金蝶库存!"; |
| | | return false; |
| | | } |
| | | //判断扫描数量与金蝶库存数量 |
| | | else if (sRelQty > sERPQty) |
| | | { |
| | | sRelQty = sERPQty; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (sRelQty == 0) |
| | | { |
| | | sErrMsg = "启用条码库存控制,所扫描条码无条码库存!"; |
| | | return false; |
| | | } |
| | | |
| | | if(HWhID ==HSCWHID && HSPID == HSCSPID) |