/// <summary> /// 提交SAP /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCommit_Click(object sender, EventArgs e) { DMWJEXECUTE services = new DMWJEXECUTE(); IList<string> messList = new List<string>(); messList.Clear(); try { bool isChecked = false; //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { int financeBillId = 0, financeBillLineNum = 0; string strMaterialNo = "", custNo = "", custNm = ""; DateTime stockDt, arriveDt; double num = 0; financeBillId = Convert.ToInt32(this.grid.DataKeys[gvrow.RowIndex]["financeBillId"]); financeBillLineNum = Convert.ToInt32(this.grid.DataKeys[gvrow.RowIndex]["financeBillLineNum"]); strMaterialNo = this.grid.DataKeys[gvrow.RowIndex]["materialNo"].ToString(); num = Convert.ToDouble(this.grid.DataKeys[gvrow.RowIndex]["num"]); stockDt = Convert.ToDateTime(this.grid.DataKeys[gvrow.RowIndex]["stockDt"]); arriveDt = Convert.ToDateTime(this.grid.DataKeys[gvrow.RowIndex]["arriveDt"]); custNo = this.grid.DataKeys[gvrow.RowIndex]["custNo"].ToString(); custNm = this.grid.DataKeys[gvrow.RowIndex]["custNm"].ToString(); string mess = Convert.ToInt32(chkId.ValidationGroup).ToString() + ";" + financeBillId.ToString() + ";" + financeBillLineNum.ToString() + ";" + strMaterialNo + ";" + num.ToString() + ";" + stockDt + ";" + arriveDt + ";" + custNo + ";" + custNm; messList.Add(mess); //strResult = services.SAPInStock(Convert.ToInt32(chkId.ValidationGroup), financeBillId, // financeBillLineNum, strMaterialNo, num, stockDt, arriveDt, custNo, custNm); //if (strResult.Split('&')[0] == "1") //{ // isChecked = true; //} //else if (strResult.Split('&')[0] == "0") //{ // this.BindGrid(); // this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"" + strResult.Split('&')[1] + "\");", true); // return; //} } } if (messList.Count > 0) { SapOnlineService.SapOnlineService sapService = new SapOnlineService.SapOnlineService(); SapOnlineService.POR1[] list = new SapOnlineService.POR1[messList.Count]; for (int i = 0; i < messList.Count; i++) { SapOnlineService.POR1 por1 = new SapOnlineService.POR1(); por1.DocEntry = Convert.ToInt32(messList[i].Split(';')[1].ToString()); por1.LineNum = Convert.ToInt32(messList[i].Split(';')[2].ToString()); por1.ItemCode = messList[i].Split(';')[3].ToString(); por1.Quantity = Convert.ToDouble(messList[i].Split(';')[4].ToString());//数量 list[i] = por1; } string strResult = sapService.Web_AddPDN_For_POR1(messList[0].Split(';')[7].ToString(), messList[0].Split(';')[8].ToString(), Convert.ToDateTime(messList[0].Split(';')[5].ToString()), "由WMS同步", Convert.ToDateTime(messList[0].Split(';')[5].ToString()), "由WMS同步", Convert.ToDateTime(messList[0].Split(';')[6].ToString()), list); if (strResult.Split('&')[0] == "1") { for (int i = 0; i < messList.Count; i++) { BArriveDetailData arriveDetailModel = new BArriveDetailData(); BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); SCommBB commBB = new SCommBB(); arriveDetailModel = arriveDetailBB.GetModel(Convert.ToInt32(messList[i].Split(';')[0])); arriveDetailModel.isSapInStock = true;//是否已提交SAP入库 arriveDetailBB.ModifyRecord(arriveDetailModel); //更改物料箱的“是否已提交SAP入库”状态 commBB.ExecuteSql(@"update dbo.BArrangeBillBox set isSapInStock=1 where isSapInStock=0 and inStockDt is not null and arriveBillNo='" + arriveDetailModel.arriveBillNo + "' and financeBillId='" + messList[i].Split(';')[1].ToString() + "' and financeBillLineNum='" + messList[i].Split(';')[2].ToString() + "' and materialNo='" + messList[i].Split(';')[3].ToString() + "'" +" or oldMaterialNo ='"+ messList[i].Split(';')[3].ToString() + "'" +" and isSapInStock=0 and inStockDt is not null and arriveBillNo='" + arriveDetailModel.arriveBillNo + "' and financeBillId='" + messList[i].Split(';')[1].ToString() + "' and financeBillLineNum='" + messList[i].Split(';')[2].ToString()+"'"); } isChecked = true; } else if (strResult.Split('&')[0] == "0") { this.BindGrid(); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"" + strResult.Split('&')[1] + "\");", true); return; } } if (isChecked) { this.BindGrid(); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"SAP入库成功!\");", true); } } catch (Exception error) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"" + error.Message + "\");", true); } finally { services.Dispose(); } }
/// <summary> /// 到货单列表行事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); try { GridViewRow gvRow = (e.CommandSource as LinkButton).NamingContainer as GridViewRow; BArriveDetailData arriveDetailModel = new BArriveDetailData(); #region 重新收货 if (e.CommandName == "receive") { int id = Convert.ToInt32(this.grid.DataKeys[gvRow.RowIndex]["id"]); arriveDetailModel = arriveDetailBB.GetModel(id); arriveDetailModel.isFinishReceive = false;//收货未完成 arriveDetailBB.ModifyRecord(arriveDetailModel); return; } #endregion 重新收货 } finally { arriveDetailBB.Dispose(); } }
/// <summary> /// 提交按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCommit_Click(object sender, EventArgs e) { DMWJEXECUTE services = new DMWJEXECUTE(); IList<string> messList = new List<string>(); messList.Clear(); try { bool isChecked = false; //获取选中的数据Id foreach (GridViewRow gvrow in this.grid.Rows) { CheckBox chkId = (CheckBox)gvrow.FindControl("chkId"); if (chkId.Checked == true) { int financeBillId = 0, financeBillLineNum = 0; string strMaterialNo = "", custNo = "", custNm = ""; string financeBillNo = ""; DateTime stockDt, arriveDt; double num = 0; string SAPDocEntry = ""; string arrivebillNO = ""; //financeBillId = Convert.ToInt32(this.grid.DataKeys[gvrow.RowIndex]["financeBillId"]); financeBillLineNum = Convert.ToInt32(this.grid.DataKeys[gvrow.RowIndex]["financeBillLineNum"]); arrivebillNO = this.grid.DataKeys[gvrow.RowIndex]["arriveBillNo"].ToString(); financeBillNo = this.grid.DataKeys[gvrow.RowIndex]["financeBillNo"].ToString(); SAPDocEntry = arrivebillNO.Remove(0, 2); strMaterialNo = this.grid.DataKeys[gvrow.RowIndex]["materialNo"].ToString(); num = Convert.ToDouble(this.grid.DataKeys[gvrow.RowIndex]["num"]); stockDt = Convert.ToDateTime(this.grid.DataKeys[gvrow.RowIndex]["stockDt"]); arriveDt = Convert.ToDateTime(this.grid.DataKeys[gvrow.RowIndex]["arriveDt"]); custNo = this.grid.DataKeys[gvrow.RowIndex]["custNo"].ToString(); custNm = this.grid.DataKeys[gvrow.RowIndex]["custNm"].ToString(); SapOnlineService.SapOnlineService sapService = new SapOnlineService.SapOnlineService(); string strResult = sapService.IGN1_Web_Add_From_WMS(Convert.ToDateTime(stockDt), financeBillNo, int.Parse(SAPDocEntry), strMaterialNo, num, "01"); int id = Convert.ToInt32(chkId.ValidationGroup); if (strResult.Split('&')[0] == "1") { BArriveDetailData arriveDetailModel = new BArriveDetailData(); BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); SCommBB commBB = new SCommBB(); arriveDetailModel = arriveDetailBB.GetModel(id); arriveDetailModel.isSapInStock = true;//是否已提交SAP入库 arriveDetailBB.ModifyRecord(arriveDetailModel); //更改物料箱的“是否已提交SAP入库”状态 commBB.ExecuteSql(@"update dbo.BArrangeBillBox set isSapInStock=1 where isSapInStock=0 and inStockDt is not null and arriveBillNo='" + arriveDetailModel.arriveBillNo + "' and financeBillLineNum='" + financeBillLineNum + "' and materialNo='" +strMaterialNo + "'" + " or oldMaterialNo ='" +strMaterialNo+ "'" + " and isSapInStock=0 and inStockDt is not null and arriveBillNo='" + arriveDetailModel.arriveBillNo + "'and financeBillLineNum='" + financeBillLineNum + "'"); isChecked = true; } else if (strResult.Split('&')[0] == "0") { this.BindGrid(); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"" + strResult.Split('&')[1] + "\");", true); return; } } if (isChecked) { this.BindGrid(); this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"SAP入库成功!\");", true); } } } catch (Exception error) { this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert(\"" + error.Message + "\");", true); } finally { services.Dispose(); } }
public bool UpdateArriveDetailWeight(int arriveDetailId, double firstBoxSingleWeight) { BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); try { BArriveDetailData arriveDetailModel = new BArriveDetailData(); arriveDetailModel = arriveDetailBB.GetModel(arriveDetailId); arriveDetailModel.firstBoxSingleWeight = firstBoxSingleWeight; return arriveDetailBB.ModifyRecord(arriveDetailModel); } finally { arriveDetailBB.Dispose(); } }
public void FinishTSArriveDetail(int arriveDetailId) { BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); SCommBB commBB = new SCommBB(); try { BArriveDetailData arriveDetailModel = new BArriveDetailData(); object obj = null; string strArriveBillNo = "", strFinanceBillNo = "", strMaterialNo = ""; arriveDetailModel = arriveDetailBB.GetModel(arriveDetailId); arriveDetailModel.isFinishReceive = true;//收货完成 arriveDetailBB.ModifyRecord(arriveDetailModel); //更改到货单明细的排托数量 strArriveBillNo = arriveDetailModel.arriveBillNo; strFinanceBillNo = arriveDetailModel.financeBillNo; strMaterialNo = arriveDetailModel.materialNo; obj = commBB.ExecuteScalar("select count(1) from dbo.BArrangeBillBox where arriveBillNo='" + strArriveBillNo + "' and financeBillNo='" + strFinanceBillNo + "' and materialNo='" + strMaterialNo + "'"); if (obj != null) { commBB.ExecuteSql("update dbo.BarriveDetail set boxNum=" + obj.ToString() + " where id=" + arriveDetailId.ToString()); } } finally { arriveDetailBB.Dispose(); commBB.Dispose(); } }
public void SaveArriveBox(int arriveDetailId, string strArriveBillNo, string strFinanceBillNo, string strMaterialNo, string strBoxNo, string strPalletNo, int factNum, int isrtEmpId, string strWareLocatorNo) { BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); BArrangeBillBoxBB arrangeBillBoxBB = new BArrangeBillBoxBB(); SCommBB commBB = new SCommBB(); try { BArriveDetailData arriveDetailModel = new BArriveDetailData(); BArrangeBillBoxData arrangeBillBoxModel = new BArrangeBillBoxData(); DataTable dtWareLocator = new DataTable(); //获取某库位信息 dtWareLocator = this.GetWareLocatorInfo(strWareLocatorNo); //获取到货单明细实例 arriveDetailModel = arriveDetailBB.GetModel(arriveDetailId); arrangeBillBoxModel.arriveBillNo = strArriveBillNo;//到货单号 arrangeBillBoxModel.financeBillNo = strFinanceBillNo;//采购单号 arrangeBillBoxModel.financeBillId = arriveDetailModel.financeBillId;//采购订单ID arrangeBillBoxModel.financeBillLineNum = arriveDetailModel.financeBillLineNum;//采购订单行号 arrangeBillBoxModel.materialNo = strMaterialNo;//物料号 arrangeBillBoxModel.boxNo = strBoxNo;//箱号 arrangeBillBoxModel.palletNo = strPalletNo;//托盘号 arrangeBillBoxModel.wareNo = dtWareLocator.Rows[0]["wareNo"].ToString();//库区 arrangeBillBoxModel.wareLocatorNo = strWareLocatorNo;//库位 arrangeBillBoxModel.isBoxArrange = false;//箱子是否已经排托 arrangeBillBoxModel.isPalletUsing = false;//托盘是否占用 arrangeBillBoxModel.acceptEmpId = isrtEmpId;//收货人 arrangeBillBoxModel.acceptDt = System.DateTime.Now.ToString();//收货时间 arrangeBillBoxModel.factNum = factNum;//收货数量 arrangeBillBoxBB.AddRecord(arrangeBillBoxModel); //锁定库位 commBB.ExecuteSql("update dbo.LWareLocator set isUsing=1 where wareLocatorNo='" + strWareLocatorNo + "'"); } finally { arriveDetailBB.Dispose(); arrangeBillBoxBB.Dispose(); commBB.Dispose(); } }
public string SAPInStock(int arriveDetailId, int financeBillId, int financeBillLineNum, string strMaterialNo, double num, DateTime stockDt, DateTime arriveDt, string custNo, string custNm) { SapOnlineService.SapOnlineService sapService = new SapOnlineService.SapOnlineService(); SCommBB commBB = new SCommBB(); BArriveDetailBB arriveDetailBB = new BArriveDetailBB(); try { SapOnlineService.POR1[] list = null; SapOnlineService.POR1 por1 = new SapOnlineService.POR1(); BArriveDetailData arriveDetailModel = new BArriveDetailData(); string strResult = ""; //SAP入库 //需要传递:采购订单号、行号、物料号、数量 list = new SapOnlineService.POR1[1]; por1.DocEntry = financeBillId;//采购订单号 por1.LineNum = financeBillLineNum;//采购订单行号 por1.ItemCode = strMaterialNo;//物料编号 por1.Quantity = num;//数量 list[0] = por1; strResult = sapService.Web_AddPDN_For_POR1(custNo, custNm, stockDt, "由WMS同步", stockDt, "由WMS同步", stockDt, list); // strResult = sapService.Web_AddPDN_For_POR1(por1.DocEntry, stockDt, "从仓库系统生成", arriveDt, list); if (strResult.Split('&')[0] == "1") { //更改到货中间表数据 arriveDetailModel = arriveDetailBB.GetModel(arriveDetailId); arriveDetailModel.isSapInStock = true;//是否已提交SAP入库 arriveDetailBB.ModifyRecord(arriveDetailModel); //更改物料箱的“是否已提交SAP入库”状态 commBB.ExecuteSql(@"update dbo.BArrangeBillBox set isSapInStock=1 where isSapInStock=0 and inStockDt is not null and arriveBillNo='" + arriveDetailModel.arriveBillNo + "' and financeBillId='" + financeBillId + "' and financeBillLineNum='" + financeBillLineNum + "' and materialNo='" + strMaterialNo + "'"); } return strResult; } finally { sapService.Dispose(); arriveDetailBB.Dispose(); commBB.Dispose(); } }