public void UpdateOutStockPalletEffectInfo(string strStockUpBillNo, string strPalletNo, string strNextWareNo, string strNextWareLocatorNo) { BForkliftTaskBB forkliftTaskBB = new BForkliftTaskBB(); UStockBB stockBB = new UStockBB(); try { DataTable dtStock = new DataTable(); BForkliftTaskData forkliftTaskModel = new BForkliftTaskData(); //获取托盘库存信息 dtStock = stockBB.GetList("palletNo='" + strPalletNo + "'").Tables[0]; forkliftTaskModel.taskType = "05";//任务类型为:从正式库区到拣货工作区 forkliftTaskModel.palletNo = strPalletNo;//托盘号 //源库位信息 if (dtStock.Rows.Count > 0) { forkliftTaskModel.preWareNo = dtStock.Rows[0]["wareNo"].ToString();//源库区 forkliftTaskModel.preLocatorNo = dtStock.Rows[0]["wareLocatorNo"].ToString();//源库位 } forkliftTaskModel.nextWareNo = strNextWareNo;//目的库区 forkliftTaskModel.nextLocatorNo = strNextWareLocatorNo;//目的库位 forkliftTaskModel.effectDt = System.DateTime.Now.ToString();//生效时间 forkliftTaskModel.isDeal = false;//是否处理 forkliftTaskModel.stockUpBillNo = strStockUpBillNo;//备货单编号 forkliftTaskBB.AddRecord(forkliftTaskModel); } finally { forkliftTaskBB.Dispose(); stockBB.Dispose(); } }
/// <summary> /// 指定入库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnInput_Click(object sender, EventArgs e) { bool retChecked = false;//是否选择 foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { UStockBB stockBB = new UStockBB(); BTallyBillBB tallyBillBB = new BTallyBillBB(); UStockBC stockBC = new UStockBC(); try { BTallyBillData tallyBillModel = tallyBillBB.GetModel(this.IdValue); if (tallyBillModel.instantState != "02")//状态不是“已理货完成” { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前托盘已经指定了库位!\");", true); return; } else { string strwhere = "wareLocatorNo='" + chkId.ValidationGroup + "'"; DataSet ds = stockBB.GetList(strwhere); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"当前库位已经被占用!\");", true); return; } else { tallyBillModel.instantState = "03";//指定状态为“已入库” tallyBillModel.isInStock = true;// 入库状态 tallyBillModel.wareLocatorNo = chkId.ValidationGroup;//库位 retChecked = stockBC.SetPalletWarelocator(tallyBillModel,this.ddlWare.SelectedValue); } } } catch (Exception ex) { this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true); return; } finally { tallyBillBB.Dispose(); stockBB.Dispose(); stockBC.Dispose(); } } } if (retChecked) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"库位指定成功!\"); location.replace('UStockList.aspx?itemNo=" + this.itemNo + "&pTypeNo=main');", true); return; } this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"请选择一个库位!\");", true); return; }
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(); } }