public DataTable GetPickOutDetail_NoFinish(string strStockUpBillNo) { CPickOutPlanBB pickOutPlanBB = new CPickOutPlanBB(); try { DataTable dt = new DataTable(); //限制托盘在拣货库区 dt = pickOutPlanBB.GetVList("stockUpBillNo='" + strStockUpBillNo + "' and instantState='02' and not exists(select 1 from dbo.vBArrangeBillBox where dbo.vCPickOutPlan.palletNo=dbo.vBArrangeBillBox.palletNo and dbo.vBArrangeBillBox.wareType<>'04') and isnull(dbo.vArrangeBillNox.wareNo,'')<>''").Tables[0]; return dt; } finally { pickOutPlanBB.Dispose(); } }
public void UpdatePickOutEmpID(string stockUpNo, int pickOutEmpId) { CPickOutPlanBB pickOutPlanBB = new CPickOutPlanBB(); try { StringBuilder strSql = new StringBuilder(); //pickOutPlanModel = pickOutPlanBB.GetModel(pickOutPlanId); ////pickOutPlanModel.pickOutDt = System.DateTime.Now.ToString();//拣货时间 //pickOutPlanModel.pickOutEmpId = pickOutEmpId;//拣货人 //pickOutPlanModel.instantState = "02";//已完成 pickOutPlanBB.ModifyRecord(stockUpNo, pickOutEmpId); ////解除库位的锁定 //strSql.Append(@"update dbo.UStock set isOutStocking=0 where wareLocatorNo='" + pickOutPlanModel.wareLocatorNo // + "' and materialNo='" + pickOutPlanModel.materialNo + "'and isOutStocking=1"); //commBB.ExecuteSql(strSql.ToString()); ////更改原箱的是否锁定状态 //strSql = new StringBuilder(); //strSql.Append("update dbo.BArrangeBillBox set isOutStocking=0 where wareLocatorNo='" + pickOutPlanModel.wareLocatorNo // + "' and materialNo='" + pickOutPlanModel.materialNo + "' and isOutStocking=1"); //commBB.ExecuteSql(strSql.ToString()); } finally { pickOutPlanBB.Dispose(); } }
public DataTable GetOutStockPalletList(string strStockUpBillNo, string strStockUpDetailIDs) { CPickOutPlanBB pickOutPlanBB = new CPickOutPlanBB(); UStockBB stockBB = new UStockBB(); CStockUpDetailBB stockUpDetailBB = new CStockUpDetailBB(); try { DataTable dtPickOutPlan = new DataTable(); DataTable dtPallet = new DataTable(); DataTable dtStock = new DataTable(); DataColumn myDataColumn = null; DataRow myDataRow = null; dtPallet.TableName = "dtPallet"; //生成托盘条码号表托盘条码号列 myDataColumn = new DataColumn(); myDataColumn.DataType = System.Type.GetType("System.String"); myDataColumn.ColumnName = "palletNo"; dtPallet.Columns.Add(myDataColumn); foreach (string strStockUpDetialId in strStockUpDetailIDs.Split(',')) { CStockUpDetailData stockUpDetailModel = new CStockUpDetailData(); stockUpDetailModel = stockUpDetailBB.GetModel(Convert.ToInt32(strStockUpDetialId)); //获取拣货计划 dtPickOutPlan = pickOutPlanBB.GetList("stockUpBillNo='" + strStockUpBillNo + "' and palletIndex='" + stockUpDetailModel.palletIndex.ToString() + "' and stockUpMaterialNo='" + stockUpDetailModel.materialNo + "' and docEntry='" + stockUpDetailModel.DocEntry.ToString() + "' and absEntry='" + stockUpDetailModel.absEntry.ToString() + "' and lineNum='" + stockUpDetailModel.lineNum.ToString() + "' and isnull(palletNo,'')<>''").Tables[0]; foreach (DataRow rowPickOutPlan in dtPickOutPlan.Rows) { string strPalletNo = rowPickOutPlan["palletNo"].ToString();//托盘条码号 //库存中原物料 dtStock = stockBB.GetList("palletNo='" + strPalletNo + "' and not exists(select 1 from dbo.BForkliftTask as t where t.palletNo='" + strPalletNo + "' and t.isDeal=0)").Tables[0]; //库存中有托盘 if (dtStock.Rows.Count > 0) { //新增一条托盘记录 if (dtPallet.Select("palletNo='" + strPalletNo + "'").Length == 0) { myDataRow = dtPallet.NewRow(); myDataRow["palletNo"] = strPalletNo; dtPallet.Rows.Add(myDataRow); } } } } ////获取拣货计划 //dtPickOutPlan = pickOutPlanBB.GetList("stockUpBillNo='" + strStockUpBillNo + "' and isnull(palletNo,'')<>''").Tables[0]; ////合计备货单明细物料剩余数量 //strSql.Append(@"select materialNo,sum(num-factNum) as leavingNum "); //strSql.Append(@"from dbo.vCStockUpDetail as stockUpDetail "); //strSql.Append(@"where id in (" + strStockUpDetailIDs + ") "); //strSql.Append(@"group by materialNo "); //dtStockUpDetail = commBB.Query(strSql.ToString()).Tables[0]; ////获取拣货托盘 //foreach (DataRow row in dtStockUpDetail.Rows) //{ // string strMaterialNo = "", strConvertMaterialNo = ""; // int leavingNum = 0; // strMaterialNo = row["materialNo"].ToString();//物料编号 // leavingNum = Convert.ToInt32(row["leavingNum"]);//剩余拣货数量 // myDataRowArray = dtPickOutPlan.Select("materialNo='" + strMaterialNo + "'"); // //根据物料转换关系查找 // if (myDataRowArray.Length == 0) // { // DataTable dtMaterialRelation = new DataTable(); // dtMaterialRelation = materialRelationBB.GetList("oldMaterialNo='" + strMaterialNo + "'").Tables[0]; // if (dtMaterialRelation.Rows.Count > 0) // { // strConvertMaterialNo = dtMaterialRelation.Rows[0]["newMaterialNo"].ToString();//转换物料号 // myDataRowArray = dtPickOutPlan.Select("materialNo='" + strConvertMaterialNo + "'"); // } // } // foreach (DataRow rowPickOutPlan in myDataRowArray) // { // if (leavingNum > 0) // { // string strPalletNo = ""; // strPalletNo = rowPickOutPlan["palletNo"].ToString();//托盘条码号 // //库存中原物料 // dtStock = stockBB.GetList("palletNo='" + strPalletNo // + "' and materialNo='" + strMaterialNo // + "' and not exists(select 1 from dbo.BForkliftTask as t where t.palletNo=dbo.UStock.palletNo and t.isDeal=0)").Tables[0]; // //库存中转换物料 // if (dtStock.Rows.Count == 0) // { // dtStock = stockBB.GetList("palletNo='" + strPalletNo // + "' and materialNo='" + strConvertMaterialNo // + "' and not exists(select 1 from dbo.BForkliftTask as t where t.palletNo=dbo.UStock.palletNo and t.isDeal=0)").Tables[0]; // } // foreach (DataRow rowStock in dtStock.Rows) // { // //新增一条托盘记录 // if (dtPallet.Select("palletNo='" + strPalletNo + "'").Length == 0) // { // myDataRow = dtPallet.NewRow(); // myDataRow["palletNo"] = strPalletNo; // dtPallet.Rows.Add(myDataRow); // } // if (Convert.ToInt32(rowStock["num"]) > leavingNum) // { // leavingNum = 0; // break; // } // else // { // leavingNum -= Convert.ToInt32(rowStock["num"]); // } // } // } // } //} return dtPallet; } finally { pickOutPlanBB.Dispose(); stockBB.Dispose(); stockUpDetailBB.Dispose(); } }