| | |
| | | sWHSPCtl = "N"; |
| | | } |
| | | |
| | | string sMultilineCtl = "N"; //校验-多行相同物料自动拆分换行匹配('Y'为自动拆分) |
| | | if (HBillType == "1207" && oSystemParameterMain.Kf_MoveStockBillCheck_MultilineCtl == "Y") |
| | | { |
| | | //直接调拨单 |
| | | sMultilineCtl = "Y"; |
| | | } |
| | | |
| | | //判断是否存在相同条码,判断所扫条码是否在单据中 |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBillCheck '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + sWHSPCtl + "'", "h_p_WMS_AddBarCode_MoveStockBillCheck"); |
| | | DataSet ds1 = oCn.RunProcReturn("exec h_p_WMS_AddBarCode_MoveStockBillCheck_New '" + omodel_View.HBarCode + "'," + HBillID.ToString() + ",'" + HBillNo + "','" + HBillType + "'," + HWhID + "," + HSPID + "," + HSCWHID + "," + HSCSPID + ",'" + sWHSPCtl + "','" + sMultilineCtl + "'", "h_p_WMS_AddBarCode_MoveStockBillCheck_New"); |
| | | if (ds1 == null || ds1.Tables[0].Rows.Count == 0) |
| | | { |
| | | sErrMsg = "判断所扫条码是否在单据中发生错误!"; |
| | |
| | | if (DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0][0]) == 0) |
| | | { |
| | | omodel_View.HMaterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HMaterID"]); |
| | | omodel_View.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HSourceBillNo"]); |
| | | 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"]); //源单可扫数量 |
| | | omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[0]["HSumQtyMust"]); //HSumQtyMust为源单相同物料剩余可扫数量 |
| | | HWhID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HWhID"]); |
| | | HSPID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSPID"]); |
| | | HSCWHID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[0]["HSCWHID"]); |
| | |
| | | } |
| | | } |
| | | |
| | | oMain.HInterID = HBillID; |
| | | oMain.HBillNo = HBillNo; |
| | | oMain.HBillType = HBillType; |
| | | oMain.HMaker = HMaker; |
| | | oMain.HMaterID = omodel_View.HMaterID; |
| | | oMain.HAuxPropID = omodel_View.HAuxPropID; |
| | | oMain.HQty = sRelQty; |
| | | oMain.HQtyMust = 0; |
| | | oMain.HBarCode = omodel_View.HBarCode; |
| | | oMain.HBatchNo = omodel_View.HBatchNo; |
| | | oMain.HMTONo = omodel_View.HMTONo; |
| | | oMain.HWhID = HWhID; |
| | | oMain.HStockPlaceID = HSPID; |
| | | oMain.HSCWHID = HSCWHID; |
| | | oMain.HOutStockPlaceID = HSCSPID; |
| | | oMain.HSourceInterID = omodel_View.HSourceInterID; |
| | | oMain.HSourceEntryID = omodel_View.HSourceEntryID; |
| | | oMain.HSourceBillNo = omodel_View.HSourceBillNo; |
| | | oMain.HSourceBillType = HBillType; |
| | | oMain.HRedBlueFlag = false; |
| | | oMain.HPieceQty = 1; |
| | | oMain.HSTOCKORGID = HOWNERID; |
| | | oMain.HOWNERID = HOWNERID; |
| | | double sSumQty = 0; |
| | | double sRemQty = 0; |
| | | for (int i = 0; i < ds1.Tables[0].Rows.Count; i++) |
| | | { |
| | | omodel_View.HSourceQty = DBUtility.ClsPub.isDoule(ds1.Tables[0].Rows[i]["HQtyMust"]); //存在相同物料时,其中一行源单剩余可扫数量 |
| | | sSumQty = sSumQty + omodel_View.HSourceQty; |
| | | sRemQty = sRelQty - sSumQty; |
| | | |
| | | oCn.RunProc("Insert into KF_PonderationBillMain_Temp " + |
| | | "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" + |
| | | ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" + |
| | | ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" + |
| | | ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" + |
| | | ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" + |
| | | ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" + |
| | | ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " + |
| | | " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() + |
| | | "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" + |
| | | "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" + |
| | | ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" + |
| | | "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" + |
| | | "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + ",'','校验模式',1" + |
| | | ",0,0,'" + oMain.HCusBarCode + "',0)"); |
| | | //数量 |
| | | //只存在一行数据时,数量=条码可扫数量 |
| | | if (ds1.Tables[0].Rows.Count==1) |
| | | { |
| | | oMain.HQty = sRelQty; |
| | | } |
| | | //存在多行相同物料,条码剩余数量<所选行源单剩余可扫数量 或 所选行源单为最后一条数据时 ,数量=条码剩余数量 |
| | | else if (sRemQty <= 0 || (i == ds1.Tables[0].Rows.Count-1 && sRemQty > 0)) |
| | | { |
| | | oMain.HQty = sRemQty + omodel_View.HSourceQty; |
| | | } |
| | | //存在多行相同物料,条码剩余数量>所选行源单剩余可扫数量 ,数量=所选行源单剩余可扫数量 |
| | | else |
| | | { |
| | | oMain.HQty = omodel_View.HSourceQty; |
| | | } |
| | | //条码条数 |
| | | if (i == 0) |
| | | { |
| | | oMain.HPieceQty = 1; |
| | | } |
| | | else |
| | | { |
| | | oMain.HPieceQty = 0; |
| | | } |
| | | |
| | | oMain.HInterID = HBillID; |
| | | oMain.HBillNo = HBillNo; |
| | | oMain.HBillType = HBillType; |
| | | oMain.HMaker = HMaker; |
| | | oMain.HMaterID = omodel_View.HMaterID; |
| | | oMain.HAuxPropID = omodel_View.HAuxPropID; |
| | | oMain.HQtyMust = 0; |
| | | oMain.HBarCode = omodel_View.HBarCode; |
| | | oMain.HBatchNo = omodel_View.HBatchNo; |
| | | oMain.HMTONo = omodel_View.HMTONo; |
| | | oMain.HWhID = HWhID; |
| | | oMain.HStockPlaceID = HSPID; |
| | | oMain.HSCWHID = HSCWHID; |
| | | oMain.HOutStockPlaceID = HSCSPID; |
| | | oMain.HSourceInterID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceInterID"]); |
| | | oMain.HSourceEntryID = DBUtility.ClsPub.isLong(ds1.Tables[0].Rows[i]["HSourceEntryID"]); |
| | | oMain.HSourceBillNo = DBUtility.ClsPub.isStrNull(ds1.Tables[0].Rows[i]["HSourceBillNo"]); |
| | | oMain.HSourceBillType = HBillType; |
| | | oMain.HRedBlueFlag = false; |
| | | oMain.HSTOCKORGID = HOWNERID; |
| | | oMain.HOWNERID = HOWNERID; |
| | | |
| | | oCn.RunProc("Insert into KF_PonderationBillMain_Temp " + |
| | | "(HInterID,HBillNo,HBillType,HMaterID,HAuxPropID,HProcID" + |
| | | ",HWhID,HSCWHID,HStockPlaceID,HOutStockPlaceID,HGroupID,HAddr" + |
| | | ",HQtyMust,HQty,HPieceQty,HBatchNo,HBarCode,HBarCode_Pack" + |
| | | ",HMaker,HMakeDate,HSourceInterID,HSourceEntryID,HSourceBillType,HSourceBillNo" + |
| | | ",HRelationInterID,HRelationEntryID,HRelationBillNo,HRedBlueFlag,HMTONo,HPlanMode" + |
| | | ",HSTOCKORGID,HOtherOrgID,HOWNERID,HOWNERTYPEID,HExpressNumber,HSubBillType" + |
| | | ",HCusID,HDeptID,HCusBarCode,HMulSourceBill) " + |
| | | " Values(" + oMain.HInterID.ToString() + ",'" + oMain.HBillNo + "','" + oMain.HBillType + "'," + oMain.HMaterID.ToString() + "," + oMain.HAuxPropID.ToString() + "," + oMain.HProcID.ToString() + |
| | | "," + oMain.HWhID.ToString() + "," + oMain.HSCWHID.ToString() + "," + oMain.HStockPlaceID.ToString() + "," + oMain.HOutStockPlaceID.ToString() + "," + oMain.HGroupID.ToString() + ",'" + oMain.HAddr + "'" + |
| | | "," + oMain.HQtyMust.ToString() + "," + oMain.HQty.ToString() + "," + oMain.HPieceQty.ToString() + ",'" + oMain.HBatchNo + "','" + oMain.HBarCode + "',''" + |
| | | ",'" + oMain.HMaker + "',getdate()," + oMain.HSourceInterID.ToString() + "," + oMain.HSourceEntryID.ToString() + ",'" + oMain.HSourceBillType + "','" + oMain.HSourceBillNo + "'" + |
| | | "," + oMain.HRelationInterID.ToString() + "," + oMain.HRelationEntryID.ToString() + ",'" + oMain.HRelationBillNo + "'," + Convert.ToString(oMain.HRedBlueFlag ? 1 : 0) + ",'" + oMain.HMTONo + "',0" + |
| | | "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HSTOCKORGID.ToString() + "," + oMain.HOWNERID.ToString() + ",'','校验模式',1" + |
| | | ",0,0,'" + oMain.HCusBarCode + "',0)"); |
| | | |
| | | if (sRemQty <= 0) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |