private void BindSpec() { Mod_TB_MATRL_MAIN model = bll.GetModel(strPlanMatCode); if (model != null) { txt_spec.Text = model.C_SPEC; } }
//库存订单 protected void btn_add_Click(object sender, EventArgs e) { try { List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>(); #region Insert Mod_TMO_ORDER modOrder = tmo_order.GetModel(ltlOrderNo.Text); Mod_TB_MATRL_MAIN modMat = tb_matrl_main.GetModel(modOrder.C_MAT_CODE); string order_no = randomnumber.CreateOrderNo(ltlConNO.Text);//订单号 modOrder.C_ORDER_NO = order_no; modOrder.N_USER_LEV = 0; modOrder.N_COST = 0; decimal N_WGT = Convert.ToDecimal(txtNum.Value ?? "0"); modOrder.N_WGT = N_WGT; //数量 modOrder.N_HSL = modMat.N_HSL == null ? 0 : modMat.N_HSL; //换算率 modOrder.N_FNUM = modMat.N_HSL == null ? 1 : N_WGT / modMat.N_HSL; //辅数量 #region //获取钢种单价-折扣-税率 decimal Price = Convert.ToDecimal(modOrder.N_ORIGINALCURTAXPRICE); //原币含税单价 decimal N_TAXRATE = Convert.ToDecimal(modOrder.N_TAXRATE) + 1; //税率 decimal N_ORIGINALCURPRICE = Convert.ToDecimal(Price) / N_TAXRATE; //原币无税单价 decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(Price); //原币含税单价 decimal N_ORIGINALCURMNY = decimal.Round(N_WGT * N_ORIGINALCURPRICE, 2); //原币无税金额 decimal N_ORIGINALCURSUMMNY = N_WGT * N_ORIGINALCURTAXPRICE; //原币价税合计 decimal N_ORIGINALCURTAXMNY = decimal.Round(N_ORIGINALCURSUMMNY - N_ORIGINALCURMNY, 2); //原币税额 modOrder.N_ORIGINALCURPRICE = N_ORIGINALCURPRICE; //原币无税单价 modOrder.N_ORIGINALCURTAXPRICE = N_ORIGINALCURTAXPRICE; //原币含税单价 modOrder.N_ORIGINALCURTAXMNY = N_ORIGINALCURTAXMNY; //原币税额 modOrder.N_ORIGINALCURMNY = N_ORIGINALCURMNY; //原币无税金额 modOrder.N_ORIGINALCURSUMMNY = N_ORIGINALCURSUMMNY; //原币价税合计 #endregion orderList.Add(modOrder); #endregion if (tmo_con.InsertKCFirstOrder(orderList)) { Response.Write("<script>alert('提交成功');window.parent.close();</script>"); } } catch (Exception ex) { WebMsg.MessageBox(ex.Message); } }
private void btn_A1_Click(object sender, EventArgs e) { int selectedPlanHandle = this.gv_TBKPSJ.FocusedRowHandle; //获取计划焦点行索引 int selectedAllowGrd = this.gv_TBKPSJ.FocusedRowHandle; //获取可轧钢种焦点行索引 if (selectedPlanHandle < 0 || selectedAllowGrd < 0) { MessageBox.Show("请检查计划和可轧钢种,记录为空!"); return; } string id = this.gv_TBKPSJ.GetRowCellValue(selectedPlanHandle, "C_COGDOWN_ID").ToString();//获取焦点id var model = bll_TRC_COGDOWN_MAIN.GetModel(id); NcRollA1 ncA1 = new NcRollA1(); var plan = bll_TRP_PLAN_COGDOWN.GetModel(model.C_PLAN_ID); var a1Sta = bll_TB_STA.GetModel(plan.C_STA_ID); ncA1.bmid = "1001NC1000000000038P"; ncA1.jhrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.jhxxsl = plan.N_WGT.ToString(); var matrl = bll_TB_MATRL_MAIN.GetModel(plan.C_MAT_CODE); ncA1.jhyid = matrl.C_PLANEMP; ncA1.jldwid = matrl.C_PK_MEASDOC; ncA1.pk_produce = matrl.C_PK_PRODUCE; ncA1.scbmid = a1Sta.C_SSBMID; ncA1.shrid = RV.UI.UserInfo.userID; ncA1.shrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.slrq = DateTime.Parse(plan.D_NEED_DT == null ? DateTime.Now.ToString() : plan.D_NEED_DT.ToString()); ncA1.wlbmid = matrl.C_PK_INVBASDOC; ncA1.xdrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.xqrq = DateTime.Parse(plan.D_DELIVERY_DT == null ? DateTime.Now.ToString() : plan.D_DELIVERY_DT.ToString()); ncA1.xqsl = plan.N_WGT.ToString(); ncA1.zdrq = DateTime.Now; ncA1.zyx1 = plan.C_FREE1; ncA1.zyx2 = plan.C_FREE2; ncA1.zyx3 = plan.C_PACK; ncA1.zyx5 = plan.C_ID; string a1Name = plan.C_ID + "_A1.xml"; var arrReault = bll_Interface_NC_Roll_A1.SendXml_ROLL_A1("", a1Name, ncA1, Application.StartupPath); if (arrReault[0] != "1") { bll_TRC_COGDOWN_MAIN.UpdateIfStatus(2, model.C_BATCH_NO, arrReault[1]); } }
//添加 protected void btnAdd_Click(object sender, EventArgs e) { try { Mod_TMO_CON modCon = tmo_con.GetModel(ltlCon_No.Text); Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(modCon.C_CUSTOMERID); List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>(); for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox cbxSelect = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkMat_Code"); //物料ID Literal ltlmatcode = (Literal)rptList.Items[i].FindControl("ltlmatcode"); //物料编码 Literal ltlmatname = (Literal)rptList.Items[i].FindControl("ltlmatname"); //物料名称 Literal ltlstlgrd = (Literal)rptList.Items[i].FindControl("ltlstlgrd"); //钢种 Literal ltlspec = (Literal)rptList.Items[i].FindControl("ltlspec"); //规格 Literal ltlC_CUST_TECH_PROT = (Literal)rptList.Items[i].FindControl("ltlC_CUST_TECH_PROT"); //客户协议 Literal ltlC_STD_CODE = (Literal)rptList.Items[i].FindControl("ltlC_STD_CODE"); //执行标准 Literal ltlzyx1 = (Literal)rptList.Items[i].FindControl("ltlzyx1"); //自由项1 Literal ltlzyx2 = (Literal)rptList.Items[i].FindControl("ltlzyx2"); //自由项2 Literal ltlC_IS_BXG = (Literal)rptList.Items[i].FindControl("ltlC_IS_BXG"); //是否不锈钢 if (cbxSelect.Checked) { #region Insert Mod_TB_MATRL_MAIN modMat = tb_matrl_main.GetModel(cbxSelect.Value); Mod_TMO_ORDER modOrder = new Mod_TMO_ORDER(); string order_no = randomnumber.CreateOrderNo(ltlCon_No.Text); //订单号 modOrder.C_ORDER_NO = order_no; modOrder.C_CON_NO = modCon.C_CON_NO; //合同号 modOrder.C_CON_NAME = modCon.C_CON_NAME; //合同名称 modOrder.C_AREA = modCon.C_AREA; //区域 modOrder.C_INVBASDOCID = modMat.C_PK_INVBASDOC; //存货档案主键 modOrder.C_INVENTORYID = modMat.C_PK_INVMANDOC; //存货管理档案主键 modOrder.C_PROD_NAME = modMat.C_PROD_NAME; //品名 modOrder.C_PROD_KIND = modMat.C_PROD_KIND; //品种 modOrder.C_MAT_CODE = modMat.C_MAT_CODE; //物料编码 modOrder.C_MAT_NAME = modMat.C_MAT_NAME; //物料名称 modOrder.C_SPEC = modMat.C_SPEC; //规格 modOrder.C_STL_GRD = modMat.C_STL_GRD; //钢种 modOrder.C_FUNITID = modMat.C_FJLDW; // "jlda0000000000000041";//辅单位 modOrder.C_UNITID = modMat.C_PK_MEASDOC; //主计量单位 //modOrder.D_NEED_DT = modCon.D_CONINVALID_DT;//需求日期 modOrder.D_DELIVERY_DT = modCon.D_CONINVALID_DT; //计划收货日期 modOrder.D_DT = DateTime.Now; //订单日期 modOrder.C_TECH_PROT = ltlC_CUST_TECH_PROT.Text; //客户协议号 modOrder.C_FREE1 = ltlzyx1.Text; //自由项1 modOrder.C_FREE2 = ltlzyx2.Text; //自由项2 modOrder.C_STD_CODE = ltlC_STD_CODE.Text; //执行标准 modOrder.C_BY4 = ltlC_IS_BXG.Text; //是否不锈钢 //modOrder.C_PACK = pack;//包装要求 decimal N_WGT = 0; modOrder.N_WGT = N_WGT; //数量 modOrder.N_HSL = modMat.N_HSL == null ? 0 : modMat.N_HSL; //换算率 modOrder.N_FNUM = modMat.N_HSL == null ? 1 : N_WGT / modMat.N_HSL; //辅数量 modOrder.C_RECEIPTCORPID = modCon.C_CRECEIPTAREAID; //收货地区 modOrder.C_RECEIVEADDRESS = modCon.C_ADDRESS; //收货地址 modOrder.C_RECEIPTCORPID = modCon.C_CRECEIPTCUSTOMERID; //收货单位 modOrder.C_CURRENCYTYPEID = modCon.C_CURRENCYTYPEID; //货币 modOrder.N_TYPE = Convert.ToDecimal(modMat.C_MAT_TYPE); modOrder.N_USER_LEV = modCon.N_CUST_LEV; //客户等级 modOrder.C_CUST_SQ = modCon.C_REAMRK; //客户要求 modOrder.C_EMP_ID = ltlC_EMP_ID.Text; //操作人ID modOrder.C_EMP_NAME = ltlC_EMP_NAME.Text; //操作人姓名 modOrder.C_CUST_NO = modCon.C_CUST_NO; //客户编码 modOrder.C_CUST_NAME = modCon.C_CUSTNAME; //客户名称 modOrder.C_SALE_CHANNEL = modCust.N_TYPE == 1 ? "经销" : "直销"; modOrder.C_LEV = GetLev("STL_GRD_Lev"); //钢种等级 modOrder.C_ORDER_LEV = GetLev("Order_Lev"); //订单等级 modOrder.N_COST = 0; //成本 modOrder.N_STATUS = 0; //待审 Mod_TMB_TAXITEMS modTaxi = tmb_taxitems.GetModel(modMat.C_PK_TAXITEMS); modOrder.N_TAXRATE = modTaxi.N_TAXRATIO; //税率 modOrder.C_VDEF1 = modMat.C_MAT_TYPE == "6" ? "1001NC100000000052Z3" : "1016NC10000000000V1A"; //质量等级 #region //获取钢种单价-折扣-税率 decimal Price = 0; decimal N_TAXRATE = Convert.ToDecimal(modOrder.N_TAXRATE) + 1; //税率 decimal N_ORIGINALCURPRICE = Convert.ToDecimal(Price) / N_TAXRATE; //原币无税单价 decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(Price); //原币含税单价 decimal N_ORIGINALCURMNY = decimal.Round(N_WGT * N_ORIGINALCURPRICE, 2); //原币无税金额 decimal N_ORIGINALCURSUMMNY = N_WGT * N_ORIGINALCURTAXPRICE; //原币价税合计 decimal N_ORIGINALCURTAXMNY = decimal.Round(N_ORIGINALCURSUMMNY - N_ORIGINALCURMNY, 2); //原币税额 modOrder.N_ORIGINALCURPRICE = N_ORIGINALCURPRICE; //原币无税单价 modOrder.N_ORIGINALCURTAXPRICE = N_ORIGINALCURTAXPRICE; //原币含税单价 modOrder.N_ORIGINALCURTAXMNY = N_ORIGINALCURTAXMNY; //原币税额 modOrder.N_ORIGINALCURMNY = N_ORIGINALCURMNY; //原币无税金额 modOrder.N_ORIGINALCURSUMMNY = N_ORIGINALCURSUMMNY; //原币价税合计 #endregion orderList.Add(modOrder); #endregion } } if (tmo_con.InsertFirstOrder(orderList)) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "window.parent.document.getElementById('imgbtnJz').click();window.parent.close();", true); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "alert('" + ex.Message + "')", true); } }
private void btn_SyncNC_Click(object sender, EventArgs e) { NcRollA1 ncA1 = new NcRollA1(); NcRollA2 ncA2 = new NcRollA2(); NcRollA3 ncA3 = new NcRollA3(); NcRollA4 ncA4 = new NcRollA4(); int result = 0; int errorStatus = 1; string errorId = ""; string strMenuName = RV.UI.UserInfo.menuName; UserLog.AddLog(strMenuName, slbwhCode + "同步NC", "同步NC", "同步NC");//添加操作日志 try { WaitingFrom.ShowWait(""); if (dtNC != null && dtNC.Rows.Count > 0) { for (int i = 0; i < dtNC.Rows.Count; i++) { string id = dtNC.Rows[i]["C_MAIN_ID"].ToString(); errorId = id; var wgd = bll_TRC_ROLL_WGD.GetModel(id, 1); var plan = bllPlanRollItem.GetModel_Item(wgd.C_PLAN_ID); if (plan.N_IS_MERGE == 1) { continue; } var a1Sta = bll_TB_STA.GetModel(plan.C_STA_ID); ncA1.bmid = "1001NC10000000000345"; ncA1.jhrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.jhxxsl = plan.N_WGT.ToString(); var matrl = bll_TB_MATRL_MAIN.GetModel(plan.C_MAT_CODE); ncA1.jhyid = matrl.C_PLANEMP; ncA1.jldwid = matrl.C_PK_MEASDOC; ncA1.pk_produce = matrl.C_PK_PRODUCE; ncA1.scbmid = a1Sta.C_SSBMID; ncA1.shrid = "1006AA100000000ERS2A";//plan.C_EMP_ID; ncA1.shrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.slrq = DateTime.Parse(plan.D_NEED_DT == null ? DateTime.Now.ToString() : plan.D_NEED_DT.ToString()); ncA1.wlbmid = matrl.C_PK_INVBASDOC; ncA1.xdrq = DateTime.Parse(plan.D_P_START_TIME == null ? DateTime.Now.ToString() : plan.D_P_START_TIME.ToString()); ncA1.xqrq = DateTime.Parse(plan.D_DELIVERY_DT == null ? DateTime.Now.ToString() : plan.D_DELIVERY_DT.ToString()); ncA1.xqsl = plan.N_WGT.ToString(); ncA1.zdrq = DateTime.Now; ncA1.zyx1 = plan.C_FREE_TERM; ncA1.zyx2 = plan.C_FREE_TERM2; ncA1.zyx3 = plan.C_PACK; ncA1.zyx5 = plan.C_ID; ncA1.memo = plan.C_AREA; ncA1.jhfaid = matrl.C_PK_PSID; string a1Name = plan.C_ID + "_A1.xml"; var resultA1 = bll_Interface_NC_Roll_A1.SendXml_ROLL_A1("", a1Name, ncA1, Application.StartupPath); if (resultA1[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(1, id, resultA1[1]); //continue; } DataTable factDt2 = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; bool bol = false; for (int j = 0; j < factDt2.Rows.Count; j++) { string slabWh = bll_TPB_LINEWH.GetList_id(factDt2.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); if (string.IsNullOrEmpty(slabWh)) { bol = true; break; } } if (bol) { continue; } errorStatus = 2; var main = bll_TRC_ROLL_MAIN.GetModel(id); var a2Sta = bll_TB_STA.GetModel(main.C_STA_ID); var matrl2 = bll_TB_MATRL_MAIN.GetModel(main.C_MAT_SLAB_CODE); ncA2.wlbmid = matrl.C_PK_INVBASDOC; ncA2.pk_produce = matrl.C_PK_PRODUCE; ncA2.invcode = matrl.C_ID; ncA2.pch = main.C_BATCH_NO; ncA2.scbmid = a2Sta.C_SSBMID; ncA2.gzzxid = a2Sta.C_ERP_PK; ncA2.bcid = wgd.C_PRODUCE_SHIFT; ncA2.bzid = wgd.C_PRODUCE_GROUP; ncA2.jhkgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA2.jhwgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA2.jhkssj = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA2.jhjssj = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA2.sjkgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA2.sjwgrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA2.sjkssj = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA2.sjjssj = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA2.jhwgsl = main.N_WGT_EXIT == 0 ? main.N_WGT_ELIM.ToString() : main.N_WGT_EXIT.ToString(); ncA2.fjhsl = main.N_QUA_EXIT == 0 ? main.N_QUA_ELIM.ToString() : main.N_QUA_EXIT.ToString(); ncA2.jldwid = matrl.C_PK_MEASDOC; ncA2.fjlid = matrl.C_FJLDW; ncA2.sjwgsl = (main.N_WGT_TOTAL_VIRTUAL - main.N_WGT_TOTAL).ToString(); ncA2.freeitemvalue1 = plan.C_FREE_TERM; ncA2.freeitemvalue2 = plan.C_FREE_TERM2; ncA2.freeitemvalue3 = plan.C_PACK; ncA2.zdrid = RV.UI.UserInfo.userAccount; ncA2.freeitemvalue5 = plan.C_ID; string a2Name = Guid.NewGuid() + "_A2.xml"; if (bll_TRC_ROLL_WGD.IsA2Repeat(main.C_BATCH_NO, "") > 0) { } var resultA2 = bll_Interface_NC_Roll_A2.SendXml_ROLL_A2("", a2Name, ncA2, Application.StartupPath); if (resultA2[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(2, id, resultA2[1]); } if (main.N_WGT_EXIT == 0) { if (bll_TRC_ROLL_WGD.UpdateUpLoadStatus(3, id) > 0) { MessageBox.Show("同步成功"); } } errorStatus = 3; ncA3.hpch = main.C_BATCH_NO; ncA3.hzdrid = RV.UI.UserInfo.userAccount; ncA3.hwlbmid = matrl.C_PK_INVBASDOC; ncA3.hjldwid = matrl.C_PK_MEASDOC; ncA3.hzdrq = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); ncA3.hfreeitemvalue1 = plan.C_FREE_TERM; ncA3.hfreeitemvalue2 = plan.C_FREE_TERM2; ncA3.hfreeitemvalue3 = plan.C_PACK; DataTable consumeDt = new DataTable(); DataTable a3Dt = bll_TRC_WARM_FURNACE.GetSlabMainInfo(wgd.C_MAIN_ID, out consumeDt); DataTable a3DtZyx = bll_TB_STD_CONFIG.GetZYX(a3Dt.Rows[0]["C_STL_GRD"].ToString(), a3Dt.Rows[0]["C_STD_CODE"].ToString()).Tables[0]; var m = bll_TB_MATRL_MAIN.GetModel(a3Dt.Rows[0]["C_MAT_CODE"].ToString()); ncA3.kgyid = RV.UI.UserInfo.userAccount; ncA3.ckckid = bll_TPB_SLABWH.GetList_id(slbwhCode); ncA3.wlbmid = matrl2.C_PK_INVBASDOC; ncA3.jldwid = matrl2.C_PK_MEASDOC; ncA3.fjldwid = matrl2.C_FJLDW; ncA3.ljcksl = a3Dt.Rows[0]["N_WGT"].ToString(); ncA3.fljcksl = a3Dt.Rows[0]["N_QUA"].ToString(); ncA3.pch = a3Dt.Rows[0]["C_BATCH_NO"].ToString() == "" ? a3Dt.Rows[0]["C_STOVE"].ToString() : a3Dt.Rows[0]["C_BATCH_NO"].ToString(); ncA3.gzzxid = a2Sta.C_ERP_PK; ncA3.freeitemvalue1 = a3Dt.Rows[0]["C_ZYX1"].ToString(); ncA3.freeitemvalue2 = a3Dt.Rows[0]["C_ZYX2"].ToString(); object objOutTime = bll_TRC_WARM_FURNACE.GetOutTime(main.C_ID); ncA3.flrq = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()).ToString("yyyy-MM-dd"); string a3Name = Guid.NewGuid() + "_A3.xml"; if (bll_TRC_ROLL_WGD.IsA3Repeat(main.C_BATCH_NO, "") > 0) { } var resultA3 = bll_Interface_NC_Roll_A3.SendXml_ROLL_A3("", a3Name, ncA3, Application.StartupPath); if (resultA3[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(3, id, resultA3[1]); } bll_TRC_WARM_FURNACE.ConsumeSlab(consumeDt); errorStatus = 4; DataTable a4FactDt = bll_TRC_ROLL_WGD.GetWgdFact(wgd.C_BATCH_NO, 1).Tables[0]; var a4M = bll_TB_MATRL_MAIN.GetModel(wgd.C_MAT_CODE); var a4Sta = bll_TB_STA.GetModel(wgd.C_STA_ID); ncA4.zdrid = RV.UI.UserInfo.userAccount; ncA4.rq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA4.gzzxbmid = a4Sta.C_STA_ERPCODE; ncA4.scbmid = a4Sta.C_SSBMID; ncA4.pch = wgd.C_BATCH_NO; ncA4.wlbmid = a4M.C_PK_INVBASDOC; ncA4.jldwid = a4M.C_PK_MEASDOC; ncA4.gzzxid = a4Sta.C_ERP_PK; ncA4.ccxh = wgd.C_BATCH_NO; ncA4.pk_produce = a4M.C_PK_PRODUCE; ncA4.ksrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA4.jsrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA4.hgsl = a4FactDt.Rows[0]["WGT"].ToString(); ncA4.fhgsl = a4FactDt.Rows[0]["QUA"].ToString(); object wgdHandlerStatus = bll_TRC_ROLL_WGD_HANDLER.GetWgdHandlerStatus(wgd.C_ID); if (wgdHandlerStatus != null) { string status = wgdHandlerStatus.ToString(); ncA4.sflfcp = int.Parse(status) == 2 ? "Y" : "N"; ncA4.sffsgp = int.Parse(status) == 2 ? "Y" : "N"; } else { ncA4.sflfcp = "N"; ncA4.sffsgp = "N"; } ncA4.freeitemvalue1 = wgd.C_FREE_TERM; ncA4.freeitemvalue2 = wgd.C_FREE_TERM2; ncA4.freeitemvalue3 = wgd.C_PACK; string a4Name = Guid.NewGuid() + "_A4.xml"; if (bll_TRC_ROLL_WGD.IsA4Repeat(main.C_BATCH_NO, "") > 0) { } var resultA4 = bll_Interface_NC_Roll_A4.SendXml_ROLL_A4("", a4Name, ncA4, Application.StartupPath); if (resultA4[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(4, id, resultA4[1]); } errorStatus = 5; decimal wgdWgt = 0; DataTable factDt = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; List <NcRoll46> nc46s = new List <NcRoll46>(); for (int j = 0; j < factDt.Rows.Count; j++) { NcRoll46 nc46 = new NcRoll46(); var a46M = bll_TB_MATRL_MAIN.GetModel(factDt.Rows[j]["C_MAT_CODE"].ToString()); nc46.cwarehouseid = bll_TPB_LINEWH.GetList_id(factDt.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); nc46.taccounttime = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); nc46.coperatorid = RV.UI.UserInfo.userAccount; //if (wgd.C_MRSX == "DP") //{ } nc46.ccheckstate_bid = bll_TQB_CHECKSTATE.GetModelByName("DP", "1001").C_ID; //else // nc46.ccheckstate_bid = bll_TQB_CHECKSTATE.GetModelByName(factDt.Rows[j]["C_JUDGE_LEV_BP"].ToString(), "1001").C_ID; nc46.cworkcenterid = bll_TB_STA.Get_NC_ID(wgd.C_STA_ID); nc46.dbizdate = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); nc46.vbatchcode = wgd.C_BATCH_NO; nc46.cinvbasid = a46M.C_PK_INVBASDOC; nc46.pk_produce = a46M.C_PK_PRODUCE; nc46.ninnum = factDt.Rows[j]["WGT"].ToString(); nc46.ninassistnum = factDt.Rows[j]["QUA"].ToString(); nc46.castunitid = a46M.C_FJLDW; nc46.vfree1 = factDt.Rows[j]["C_ZYX1"].ToString(); nc46.vfree2 = factDt.Rows[j]["C_ZYX2"].ToString(); nc46.vfree3 = factDt.Rows[j]["C_BZYQ"].ToString(); nc46s.Add(nc46); wgdWgt += decimal.Parse(factDt.Rows[j]["WGT"].ToString()); } string a46Name = Guid.NewGuid() + "_A46.xml"; var resultA46 = bll_Interface_NC_Roll_46.SendXml_ROLL_46("", a46Name, nc46s, Application.StartupPath); if (resultA46[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(5, id, resultA46[1]); } if (bll_TRC_ROLL_WGD.Is46Repeat(main.C_BATCH_NO, "") > 0) { bll_TRC_ROLL_WGD.UpdateRollPlanItemWgt(plan.C_ID, wgdWgt); if (bll_TRC_ROLL_WGD.UpdateUpLoadStatus(3, id) > 0) { result++; } } } } WaitingFrom.CloseWait(); MessageBox.Show("同步成功" + result); } catch (Exception ex) { bll_TRC_ROLL_WGD.UpdateIfStatus(errorStatus, errorId, ex.Message); MessageBox.Show("同步错误"); } BindWgd(); }
private bool InsertOrder() { List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>(); if (Session["kh"] != null) { DataTable dt = (DataTable)Session["kh"]; for (int i = 0; i < dt.Rows.Count; i++) { #region 数据操作 Mod_TS_USER modUser = ts_user.GetModel(ltlC_EMP_ID.Text); Mod_TMO_CON modCon = tmo_con.GetModel(txtConNO.Text); Mod_TB_MATRL_MAIN modMat = tb_matrl_main.GetModel(dt.Rows[i]["C_ID"].ToString()); Mod_TS_CUSTFILE modCust = ts_custfile.GetModel(modUser.C_CUST_ID); Mod_TMO_ORDER modOrder = new Mod_TMO_ORDER(); string order_no = randomnumber.CreateOrderNo(txtConNO.Text); //订单号 modOrder.C_ORDER_NO = order_no; modOrder.C_CON_NO = txtConNO.Text; //合同号 modOrder.C_CON_NAME = modCon.C_CON_NAME; //合同名称 modOrder.C_AREA = modCon.C_AREA; //区域 modOrder.C_INVBASDOCID = modMat.C_PK_INVBASDOC; //存货档案主键 modOrder.C_INVENTORYID = modMat.C_PK_INVMANDOC; //存货管理档案主键 modOrder.C_PROD_NAME = modMat.C_PROD_NAME; //品名 modOrder.C_PROD_KIND = modMat.C_PROD_KIND; //品种 modOrder.C_MAT_CODE = modMat.C_MAT_CODE; //物料编码 modOrder.C_MAT_NAME = modMat.C_MAT_NAME; //物料名称 modOrder.C_SPEC = modMat.C_SPEC; //规格 modOrder.C_STL_GRD = modMat.C_MAT_TYPE == "841" ? modMat.C_MAT_NAME : modMat.C_MAT_TYPE == "851" ? modMat.C_MAT_NAME : modMat.C_STL_GRD; //钢种 modOrder.C_FUNITID = modMat.C_FJLDW; //辅单位 modOrder.C_UNITID = modMat.C_PK_MEASDOC; //主计量单位 modOrder.D_DELIVERY_DT = modCon.D_CONINVALID_DT; //计划收货日期 modOrder.D_DT = modCon.D_CONSING_DT; //订单日期//签单日期 modOrder.C_VDEF1 = ""; //质量ID modOrder.C_SFPJ = "N"; modOrder.C_TECH_PROT = dt.Rows[i]["C_CUST_TECH_PROT"].ToString(); //客户协议号 modOrder.C_STD_CODE = dt.Rows[i]["C_STD_CODE"].ToString(); //执行标准 modOrder.C_FREE1 = dt.Rows[i]["ZYX1"].ToString(); //自由项1 modOrder.C_FREE2 = dt.Rows[i]["ZYX2"].ToString(); //自由项2 modOrder.C_BY4 = dt.Rows[i]["C_BY4"].ToString(); //是否不锈钢 modOrder.N_TYPE = Convert.ToDecimal(modMat.C_MAT_TYPE); modOrder.C_PACK = dt.Rows[i]["C_PACK"].ToString(); //包装要求 modOrder.C_RECEIPTAREAID = modCon.C_CRECEIPTAREAID; //收货地区 modOrder.C_RECEIVEADDRESS = modCon.C_ADDRESS; //收货地址 modOrder.C_RECEIPTCORPID = modCon.C_CRECEIPTCUSTOMERID; //收货单位 modOrder.C_CURRENCYTYPEID = modCon.C_CURRENCYTYPEID; //货币 modOrder.N_TYPE = Convert.ToDecimal(modMat.C_MAT_TYPE); modOrder.N_USER_LEV = modCon.N_CUST_LEV; //客户等级 modOrder.C_REMARK = modCon.C_REAMRK; modOrder.C_EMP_ID = modUser.C_ID; modOrder.C_EMP_NAME = modUser.C_EMP_NAME; modOrder.C_CUST_NO = modCust.C_NO; modOrder.C_CUST_NAME = modCust.C_NAME; modOrder.C_SALE_CHANNEL = modCust.N_TYPE == 1 ? "经销" : "直销"; modOrder.C_LEV = GetLev("STL_GRD_Lev"); //钢种等级 modOrder.C_ORDER_LEV = GetLev("Order_Lev"); //订单等级 modOrder.N_COST = 0; //成本 modOrder.N_STATUS = -1; //订单状态 decimal N_WGT = 0; if (!string.IsNullOrEmpty(dt.Rows[i]["N_WGT"].ToString())) { N_WGT = Convert.ToDecimal(dt.Rows[i]["N_WGT"].ToString()); } modOrder.N_WGT = N_WGT; //数量 modOrder.N_HSL = modMat.N_HSL == null ? 0 : modMat.N_HSL; //换算率 modOrder.N_FNUM = modMat.N_HSL == null ? 1 : N_WGT / modMat.N_HSL; //辅数量 if (!string.IsNullOrEmpty(modMat.C_PK_TAXITEMS)) { Mod_TMB_TAXITEMS modTaxi = tmb_taxitems.GetModel(modMat.C_PK_TAXITEMS); modOrder.N_TAXRATE = modTaxi.N_TAXRATIO; //税率 #region //获取钢种单价-税率 string Price = dt.Rows[i]["PRICE"].ToString().ToString() == "" ? "0" : dt.Rows[i]["PRICE"].ToString().ToString(); //单价 if (!string.IsNullOrEmpty(Price)) { decimal N_TAXRATE = Convert.ToDecimal(modOrder.N_TAXRATE) + 1; //税率 decimal N_ORIGINALCURPRICE = decimal.Round(Convert.ToDecimal(Price) / N_TAXRATE, 2); //原币无税单价 decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(Price); //原币含税单价 decimal N_ORIGINALCURMNY = N_WGT * N_ORIGINALCURPRICE; //原币无税金额 decimal N_ORIGINALCURSUMMNY = N_WGT * N_ORIGINALCURTAXPRICE; //原币价税合计 decimal N_ORIGINALCURTAXMNY = N_ORIGINALCURSUMMNY - N_ORIGINALCURMNY; //原币税额 modOrder.N_ORIGINALCURPRICE = N_ORIGINALCURPRICE; //原币无税单价 modOrder.N_ORIGINALCURTAXPRICE = N_ORIGINALCURTAXPRICE; //原币含税单价 modOrder.N_ORIGINALCURTAXMNY = N_ORIGINALCURTAXMNY; //原币税额 modOrder.N_ORIGINALCURMNY = N_ORIGINALCURMNY; //原币无税金额 modOrder.N_ORIGINALCURSUMMNY = N_ORIGINALCURSUMMNY; //原币价税合计 } #endregion } orderList.Add(modOrder); #endregion } } return(tmo_con.InsertFirstOrder(orderList)); }
public AjaxResult OrderAdd([FromBody] dynamic Json) { #region //参数 string ConNo = Json.ConNo; //合同号 string MatID = Json.MatID; //物料ID string TechProt = Json.TechProt; //客户协议号 string StdCode = Json.StdCode; //执行标准 string Pack = Json.Pack; //包装要求 string Wgt = Json.Wgt; //重量 string Price = Json.Price; //含税单价 string VdefID = Json.VdefID; //质量ID #endregion #region 数据操作 AjaxResult result = new AjaxResult(); result.Code = DoResult.Success; Mod_TS_USER modUser = GetUserID(); Mod_TMO_CON modCon = tmo_con.GetModel(ConNo); Mod_TB_MATRL_MAIN modMat = tb_matrl_main.GetModel(MatID); Mod_TS_CUSTFILE modCust = ts_custfile.GetModel(modUser.C_CUST_ID); Mod_TMO_ORDER modOrder = new Mod_TMO_ORDER(); DataTable dt = tb_matrl_main.GetCustStlGrd(modCust.C_NO, modMat.C_MAT_CODE, modMat.C_STL_GRD, modMat.C_SPEC, TechProt, StdCode).Tables[0]; string order_no = randomnumber.CreateOrderNo(ConNo); //订单号 modOrder.C_ORDER_NO = order_no; modOrder.C_CON_NO = modCon.C_CON_NO; //合同号 modOrder.C_CON_NAME = modCon.C_CON_NAME; //合同名称 modOrder.C_AREA = modCon.C_AREA; //区域 modOrder.C_INVBASDOCID = modMat.C_PK_INVBASDOC; //存货档案主键 modOrder.C_INVENTORYID = modMat.C_PK_INVMANDOC; //存货管理档案主键 modOrder.C_PROD_NAME = modMat.C_PROD_NAME; //品名 modOrder.C_PROD_KIND = modMat.C_PROD_KIND; //品种 modOrder.C_MAT_CODE = modMat.C_MAT_CODE; //物料编码 modOrder.C_MAT_NAME = modMat.C_MAT_NAME; //物料名称 modOrder.C_SPEC = modMat.C_SPEC; //规格 modOrder.C_STL_GRD = modMat.C_STL_GRD; //钢种 modOrder.C_FUNITID = modMat.C_FJLDW; //辅单位 modOrder.C_UNITID = modMat.C_PK_MEASDOC; //主计量单位 modOrder.D_DELIVERY_DT = modCon.D_CONINVALID_DT; //计划交货日期 modOrder.D_DT = modCon.D_CONSING_DT; //订单日期//签单日期 modOrder.C_VDEF1 = VdefID; //质量主键ID modOrder.C_SFPJ = "N"; modOrder.C_TECH_PROT = TechProt; //客户协议号 modOrder.C_FREE1 = dt?.Rows[0]["C_ZYX1"].ToString() ?? ""; //自由项1 modOrder.C_FREE2 = dt?.Rows[0]["C_ZYX2"].ToString() ?? ""; //自由项2 modOrder.C_STD_CODE = StdCode; //执行标准 modOrder.C_BY4 = dt?.Rows[0]["C_IS_BXG"].ToString() ?? ""; //是否不锈钢 modOrder.N_TYPE = Convert.ToDecimal(modMat.C_MAT_TYPE); //订单类型 modOrder.C_PACK = Pack;//包装要求 Mod_TMB_TAXITEMS modTaxi = tmb_taxitems.GetModel(modMat.C_PK_TAXITEMS); modOrder.N_TAXRATE = modTaxi.N_TAXRATIO;//税率 decimal N_WGT = 0; if (!string.IsNullOrEmpty(Wgt)) { N_WGT = Convert.ToDecimal(Wgt); } modOrder.N_WGT = N_WGT; //数量 modOrder.N_HSL = modMat.N_HSL == null ? 0 : modMat.N_HSL; //换算率 modOrder.N_FNUM = modMat.N_HSL == null ? 1 : N_WGT / modMat.N_HSL; //辅数量 #region //获取钢种单价-税率 if (!string.IsNullOrEmpty(Price)) { decimal N_TAXRATE = Convert.ToDecimal(modOrder.N_TAXRATE) + 1; //税率 decimal N_ORIGINALCURPRICE = Convert.ToDecimal(Price) / N_TAXRATE; //原币无税单价 decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(Price); //原币含税单价 decimal N_ORIGINALCURMNY = decimal.Round(N_WGT * N_ORIGINALCURPRICE, 2); //原币无税金额 decimal N_ORIGINALCURSUMMNY = N_WGT * N_ORIGINALCURTAXPRICE; //原币价税合计 decimal N_ORIGINALCURTAXMNY = decimal.Round(N_ORIGINALCURSUMMNY - N_ORIGINALCURMNY, 2); //原币税额 modOrder.N_ORIGINALCURPRICE = N_ORIGINALCURPRICE; //原币无税单价 modOrder.N_ORIGINALCURTAXPRICE = N_ORIGINALCURTAXPRICE; //原币含税单价 modOrder.N_ORIGINALCURTAXMNY = N_ORIGINALCURTAXMNY; //原币税额 modOrder.N_ORIGINALCURMNY = N_ORIGINALCURMNY; //原币无税金额 modOrder.N_ORIGINALCURSUMMNY = N_ORIGINALCURSUMMNY; //原币价税合计 } #endregion modOrder.C_RECEIPTAREAID = modCon.C_CRECEIPTAREAID; //收货地区 modOrder.C_RECEIVEADDRESS = modCon.C_ADDRESS; //收货地址 modOrder.C_RECEIPTCORPID = modCon.C_CRECEIPTCUSTOMERID; //收货单位 modOrder.C_CURRENCYTYPEID = modCon.C_CURRENCYTYPEID; //货币 modOrder.N_USER_LEV = modCon.N_CUST_LEV; //客户等级 modOrder.C_CUST_SQ = modCon.C_REAMRK; //客户要求 modOrder.C_EMP_ID = modCon.C_EMP_ID; modOrder.C_EMP_NAME = modCon.C_EMP_NAME; modOrder.C_CUST_NO = modCust.C_NO; modOrder.C_CUST_NAME = modCust.C_NAME; modOrder.C_SALE_CHANNEL = ""; modOrder.C_LEV = GetLev("STL_GRD_Lev"); //钢种等级 modOrder.C_ORDER_LEV = GetLev("Order_Lev"); //订单等级 modOrder.N_COST = 0; //成本 modOrder.C_TRANSMODE = modCon.C_TRANSMODEID; //发运方式 modOrder.C_TRANSMODEID = modCon.C_TRANSMODEID; //发运方式主键 modOrder.C_YWY = ts_user.GetSaleName(modCon.C_EMPLOYEEID); //业务员姓名 modOrder.N_STATUS = Convert.ToDecimal(modCon.N_STATUS); List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>(); orderList.Add(modOrder); result.Result = tmo_con.InsertFirstOrder(orderList) == true ? "提交成功" : "提交失败"; #endregion return(result); }
private void GetQuality() { if (!string.IsNullOrEmpty(ltlTaskID.Text)) { Mod_TMQ_QUALITY_MAIN mod = quality_main.GetModel(ltlTaskID.Text); if (mod != null) { #region //客户质量信息 //区域 if (!string.IsNullOrEmpty(mod.C_AREA)) { Mod_TMB_AREA modArea = area.GetModel(mod.C_AREA); txtArea.Text = modArea.C_NAME; } txtCustName.Text = mod.C_CUST_NAME; txtUser.Text = mod.C_NAME; txtTel.Text = mod.C_TEL; //钢种分类 if (!string.IsNullOrEmpty(mod.C_STL_GRD_CLASS)) { Mod_TB_MATRL_MAIN modClass = matrl_main.GetModel(mod.C_STL_GRD_CLASS); txtSTL_GRD.Text = modClass.C_MAT_NAME; } txtUse.Text = mod.C_PROD_USE; txtFHTime.Text = Convert.ToDateTime(mod.D_SHIP_START_DT).ToString("yyy-MM-dd"); txtDHTime.Text = Convert.ToDateTime(mod.D_SHIP_END_DT).ToString("yyy-MM-dd"); txtTouSu.Text = mod.C_OBJECT_CONTENT; txtGongYi.Text = mod.C_TECH_DESC; //客户质量钢种 DataTable dt = quality_stl_grd.GetQUALITY_STL_GRD(ltlTaskID.Text).Tables[0]; if (dt.Rows.Count > 0) { rptSTL_GRD.DataSource = dt; rptSTL_GRD.DataBind(); #region 合计 decimal ShipSum = 0; decimal ObjecSum = 0; for (int i = 0; i < dt.Rows.Count; i++) { ShipSum += Convert.ToDecimal(dt.Rows[i]["N_SHIP_WGT"].ToString() == "" ? 0 : dt.Rows[i]["N_SHIP_WGT"]); ObjecSum += Convert.ToDecimal(dt.Rows[i]["N_OBJEC_WGT"].ToString() == "" ? 0 : dt.Rows[i]["N_OBJEC_WGT"]); } ltlShipSum.Text = ShipSum.ToString(); ltlObjecSum.Text = ObjecSum.ToString(); #endregion } else { rptSTL_GRD.DataSource = null; rptSTL_GRD.DataBind(); } #endregion #region//现场处理信息 txtXinaChang.Text = mod.C_SITE_SURVEY_CONTENT; txtMuCai.Text = mod.N_PARENT_QUA.ToString(); txtWenTi.Text = mod.N_QUEST_QUA.ToString(); txtZhongJian.Text = mod.N_MIDDLE_QUA.ToString(); txtQiTa.Text = mod.N_ELSE_QUA.ToString(); txtDept.Text = mod.C_DEPT; txtZKDept.Text = mod.C_DEPT2; txtJSDept.Text = mod.C_DEPT3; txtQTDept.Text = mod.C_DEPT4; txtRemark.Text = mod.C_REMARK; #endregion } } }
/// <summary> /// 提交实绩 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Save_Click(object sender, EventArgs e) { WaitingFrom.ShowWait(""); if (DialogResult.No == MessageBox.Show("确认开坯吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } int compareDt = DateTime.Compare(this.dt_ExecStart.DateTime, this.dt_ExecEnd.DateTime); if (compareDt > 0) { MessageBox.Show("日期错误!"); return; } int errorNum = 0;//TryParse 输出参数 string planError = txt_PlanNum.Text.Trim(); if (planError != null && planError != "" && !Int32.TryParse(planError, out errorNum)) { MessageBox.Show("计划支数格式错误!"); return; } string scrapError = txt_ScrapNum.Text.Trim(); if (scrapError != null && scrapError != "" && !Int32.TryParse(scrapError, out errorNum)) { MessageBox.Show("异常支数格式错误!"); return; } DataRow dr = this.gv_GP1.GetDataRow(0);//获取计划焦点行索引 if (dr == null) { MessageBox.Show("无可开坯数据!"); return; } string gx = bll_TB_STA.GetproIdByCode(staCode); string gz = bll_TB_BCBZ.GetGZNEW(gx); sfys = bll_TB_BCBZGZ.GetSFYS(gz); var matrl = bll_TB_MATRL_MAIN.GetModel(dr["C_MAT_CODE"].ToString()); var matrl2 = bll_TB_MATRL_MAIN.GetModel(img_MatCode.EditValue.ToString()); if (matrl == null) { MessageBox.Show("请确定钢坯已出炉!"); return; } Mod_TRC_COGDOWN_PRODUCT model = new Mod_TRC_COGDOWN_PRODUCT(); model.C_COGDOWN_ID = dr["C_ID"].ToString(); //获取焦点主键 model.C_PLAN_ID = dr["C_PLAN_ID"].ToString(); //获取焦点计划主键 var planModel = bll_TRP_PLAN_COGDOWN.GetModel(model.C_PLAN_ID); model.C_BATCH_NO = dr["C_BATCH_NO"].ToString(); //获取焦点批号 model.C_STOVE = dr["C_STOVE"].ToString(); //获取焦点炉号 model.C_STL_GRD = dr["C_STL_GRD"].ToString(); //获取焦点行钢种 model.C_STD_CODE = dr["C_STD_CODE"].ToString(); //获取焦点行执行标准 model.C_STA_ID = staID; model.C_SPEC = matrl2.C_SLAB_SIZE; //钢种规格 model.N_LEN = matrl2.N_LTH; //长度 model.C_MAT_CODE = img_MatCode.EditValue.ToString(); //获取焦点物料编码 model.C_MAT_NAME = matrl2.C_MAT_NAME; //获取焦点物料名称 model.N_QUA = 1; model.N_WGT = matrl2.N_HSL; //获取焦点单重 model.C_MOVE_TYPE = "M"; //开坯待入库 model.C_REMARK = this.txt_Remark.Text; //获取焦点备注 model.C_QR_USER = UserInfo.userID; model.D_Q_DATE = DateTime.Now; object obj = bll_TRC_ROLL_WGD.GetOutTime(model.C_COGDOWN_ID); model.D_START_DATE = obj == null ? DateTime.Now : DateTime.Parse(obj.ToString()); model.D_END_DATE = RV.UI.ServerTime.timeNow(); DateTime productionTime = model.D_START_DATE.Value; if (sfys == "延时") { if (Convert.ToInt32(model.D_START_DATE.Value.ToString("HH")) >= 20) { productionTime = productionTime.AddDays(1); } } model.D_QR_DATE = DateTime.Parse(productionTime.ToString("yyyy-MM-dd")); model.C_COGDOWN_SHIFT = this.cbo_Shift.EditValue.ToString(); model.C_COGDOWN_GROUP = this.cbo_Group.EditValue.ToString(); model.C_EXTEND1 = this.cbo_Shift.Text; model.C_EXTEND2 = this.cbo_Group.Text; model.N_STATUS = 1; model.C_STOCK_STATE = "F"; model.C_QKP_STATE = "N"; model.C_COG_STA_ID = staID; model.C_ZYX1 = planModel.C_FREE1; model.C_ZYX2 = planModel.C_FREE2; model.C_JUDGE_LEV_ZH = "合格品"; model.C_MAT_TYPE = "Y"; model.C_IS_QR = "Y"; int planNum = Convert.ToInt32(this.txt_PlanNum.Text); //计划支数 int cogDownNum = Convert.ToInt32(this.txt_CogDownNum.Text); //开坯支数 if (this.txt_ScrapNum.Text == null || this.txt_ScrapNum.Text == "") { this.txt_ScrapNum.Text = "0"; } int scrapNum = Convert.ToInt32(this.txt_ScrapNum.Text);//报废支数 if (planNum == 0) { if (bll_TRC_COGDOWN_MAIN.UpdateCogDown(model.C_COGDOWN_ID) != 0) { MessageBox.Show("操作成功!"); Query1(); Query2(); } else { MessageBox.Show("操作失败!"); } return; } string result = bll_TRC_COGDOWN_MAIN.CogDownFactHandler(model, planNum, cogDownNum, scrapNum, decimal.Parse(model.N_WGT.ToString()), decimal.Parse(dr["N_PW"].ToString()), Application.StartupPath); if (result == "1") { MessageBox.Show("操作成功!"); Query1(); Query2(); //#region 同步开坯实绩到NC //DataTable dt = bll_TRC_COGDOWN_MAIN.GetCogDownFact(2, staID, 1).Tables[0]; //if (dt == null || dt.Rows.Count == 0) //{ // return; //} //for (int i = 0; i < dt.Rows.Count; i++) //{ // string re = bll_TRC_COGDOWN_MAIN.KpSyncNc(dt.Rows[i]["C_COGDOWN_ID"].ToString(), slbwhCode, staID, Application.StartupPath, dt.Rows[i]["C_COGDOWN_SHIFT"].ToString(), dt.Rows[i]["C_COGDOWN_GROUP"].ToString()); //} //#endregion } else { MessageBox.Show("操作失败!"); } WaitingFrom.CloseWait(); }
//保存订单 protected void btnsave_Click(object sender, EventArgs e) { try { bool result = true; List <string[]> list_log = new List <string[]>(); List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>(); for (int i = 0; i < rptList_Add.Items.Count; i++) { HtmlInputCheckBox chkMat_Code = (HtmlInputCheckBox)rptList_Add.Items[i].FindControl("chkMat_Code"); //物料ID Literal ltlStdCode = (Literal)rptList_Add.Items[i].FindControl("ltlStdCode"); //执行标准 Literal ltlC_IS_BXG = (Literal)rptList_Add.Items[i].FindControl("ltlC_IS_BXG"); //是否不锈钢 Literal ltlZYX1 = (Literal)rptList_Add.Items[i].FindControl("ltlZYX1"); //自由项1 Literal ltlZYX2 = (Literal)rptList_Add.Items[i].FindControl("ltlZYX2"); //自由项2 DropDownList dropArea = (DropDownList)rptList_Add.Items[i].FindControl("dropArea"); //区域 TextBox txtPack_Code = (TextBox)rptList_Add.Items[i].FindControl("txtPack_Code"); //包装 TextBox txtCustName = (TextBox)rptList_Add.Items[i].FindControl("txtCustName"); //客户 TextBox txtBXGCustName = (TextBox)rptList_Add.Items[i].FindControl("txtBXGCustName"); //不锈钢客户 TextBox txtWgt = (TextBox)rptList_Add.Items[i].FindControl("txtWgt"); //排产量 TextBox txtRemark = (TextBox)rptList_Add.Items[i].FindControl("txtRemark"); //备注 if (string.IsNullOrEmpty(txtPack_Code.Text) || tqb_pack.Exists(txtPack_Code.Text) == false) { result = false; ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "_closemsg('包装不能为空或与实际包装不符');", true); break; } if (dropArea.SelectedItem.Text != "不锈钢公司") { if (string.IsNullOrEmpty(txtCustName.Text)) { result = false; ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "_closemsg('请补全客户信息');", true); break; } } if (result) { #region //插入预测订单 Bll_RandomNumber randomnumber = new Bll_RandomNumber(); Mod_TB_MATRL_MAIN modMat = tb_matrl_main.GetModel(chkMat_Code.Value); Mod_TMO_ORDER modOrder = new Mod_TMO_ORDER(); //订单表 string orderNo = "YC" + DateTime.Now.ToString("yyyMMdd"); modOrder.C_ORDER_NO = randomnumber.CreateNeedOrderNo(orderNo); //订单号 modOrder.C_CON_NO = "YC"; //合同号 modOrder.C_AREA = dropArea.SelectedItem.Text; //区域 modOrder.C_INVBASDOCID = modMat.C_PK_INVBASDOC; //存货档案主键 modOrder.C_INVENTORYID = modMat.C_PK_INVMANDOC; //存货管理档案主键 modOrder.C_MAT_CODE = modMat.C_MAT_CODE; //物料编码 modOrder.C_MAT_NAME = modMat.C_MAT_NAME; //物料名称 modOrder.C_SPEC = modMat.C_SPEC; //规格 modOrder.C_STL_GRD = modMat.C_STL_GRD; //钢种 modOrder.C_FUNITID = modMat.C_FJLDW; //辅单位 modOrder.C_UNITID = modMat.C_PK_MEASDOC; //主计量单位 modOrder.C_YWY = ltlempname.Text; //业务员 modOrder.C_SFPJ = "N"; modOrder.N_FLAG = 1; //预测订单 modOrder.N_EXEC_STATUS = -1; //提报订单 modOrder.N_TYPE = Convert.ToDecimal(modMat.C_MAT_TYPE); //订单类型 modOrder.C_FREE1 = ltlZYX1.Text; //自由项1 modOrder.C_FREE2 = ltlZYX2.Text; //自由项2 modOrder.C_STD_CODE = ltlStdCode.Text; //执行标准 modOrder.C_BY4 = ltlC_IS_BXG.Text; //是否不锈钢 modOrder.N_WGT = Convert.ToDecimal(txtWgt.Text); modOrder.C_LEV = "普通"; //钢种等级 modOrder.C_ORDER_LEV = "三级"; //订单等级 modOrder.N_STATUS = 2; //生效 modOrder.C_EMP_ID = ltlempid.Text; modOrder.C_EMP_NAME = ltlempname.Text; modOrder.C_PACK = txtPack_Code.Text; if (modOrder.C_AREA == "不锈钢公司") { modOrder.C_CUST_NAME = txtBXGCustName.Text;//客户信息 } else { modOrder.C_CUST_NAME = txtCustName.Text;//客户信息 Bll_TS_CUSTFILE ts_custfile = new Bll_TS_CUSTFILE(); string where = $@" C_NAME='{txtCustName.Text}'"; DataTable dt = ts_custfile.GetList(where).Tables[0]; if (dt.Rows.Count > 0) { modOrder.C_CUST_NO = dt.Rows[0]["C_NO"].ToString();//客户编码 } } modOrder.C_REMARK4 = txtRemark.Text; //备注 modOrder.C_PCTBEMP = ltlempname.Text; //提报人 orderList.Add(modOrder); string[] arr_log = { "提报订单", "预测订单页面", ltlempid.Text, GetClientIP(), "", orderNo }; list_log.Add(arr_log); #endregion } } if (result) { if (tmo_con.InsertNeedOrder(orderList)) { //日志 tmo_order.InsertOrderPlanLog(list_log); ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "_closemsg('保存成功');", true); rptList_Add.DataSource = null; rptList_Add.DataBind(); SetData(); } } } catch (Exception ex) { WebMsg.MessageBox(ex.Message); } }
/// <summary> /// 新增合同 /// </summary> /// <param name="N_STATUS">合同状态</param> /// <returns></returns> private bool Add(int N_STATUS) { bool result = true; List <Mod_TMO_ORDER> orderList = new List <Mod_TMO_ORDER>(); #region //添加合同基本信息 Mod_TMO_CON modCon = new Mod_TMO_CON(); Mod_TS_DEPT modDept = ts_dept.GetModel(hiddeptid.Value); string areaCode = dropConPolicyArea.SelectedItem.Value == "" ? "01" : dropConPolicyArea.SelectedItem.Value; conNo = randomnumber.CreateConNo(areaCode); //合同号 modCon.C_CON_XH = conNo; modCon.C_CON_NO = conNo; //合同号 modCon.C_CON_NAME = txtConName.Text; //合同名称 modCon.C_CONTYPEID = dropConType.SelectedItem.Value; //合同类型 modCon.C_CUSTOMERID = hidCustID.Value; //客户ID modCon.C_CUSTNAME = txtCustName.Text; //客户名称 modCon.C_CUST_NO = hidCustNO.Value; //客户客户编码 modCon.C_EMPLOYEEID = hidsaleempid.Value; //业务员ID modCon.C_DEPTID = hiddeptid.Value; //业务部门 if (!string.IsNullOrEmpty(hiddeptid.Value)) { Mod_TS_DEPT moddept = ts_dept.GetModel(hiddeptid.Value); modCon.C_AREA = moddept.C_NAME; //部门 } modCon.C_CURRENCYTYPEID = dropCurrType.SelectedValue; //货币 modCon.D_CONSING_DT = Convert.ToDateTime(txtDate.Value); //签署日期 modCon.D_CONEFFE_DT = Convert.ToDateTime(txtStart.Value); //计划生效日期 modCon.D_CONINVALID_DT = Convert.ToDateTime(txtEnd.Value); //计划失效日期 modCon.C_TRANSMODEID = dropShipVia.SelectedValue; //发运方式 modCon.N_STATUS = N_STATUS; modCon.C_EMP_ID = ltlC_EMP_ID.Text; modCon.C_EMP_NAME = ltlC_EMP_NAME.Text; modCon.N_CUST_LEV = Convert.ToDecimal(ltlCustLEV.Text);//客户等级 if (!string.IsNullOrEmpty(hidC_CGID.Value)) { Mod_TS_CUSTFILE modCust = ts_custfile.GetCustModel(hidC_CGID.Value); modCon.C_CRECEIPTCUSTOMERID = hidC_CGID.Value; //收货单位 modCon.C_ADDRESS = txtAddr.Value; //收货地址 modCon.C_CRECEIPTAREAID = modCust.C_AREATYPE; //收货地区 } modCon.C_CRECEIPTCORPID = hidC_OTCID.Value; //开票单位 modCon.C_STATION = txtC_STATION.Value; //站点 modCon.C_REAMRK = txtReamrk.Value; modCon.N_CHANGENUM = 0; //合同变更次数 #endregion #region//添加合同明细 for (int i = 0; i < rptList.Items.Count; i++) { Literal ltlC_ID = (Literal)rptList.Items[i].FindControl("ltlC_ID"); //物料ID Literal ltlC_TECH_PROT = (Literal)rptList.Items[i].FindControl("ltlC_TECH_PROT"); //客户协议号 Literal ltlC_STD_CODE = (Literal)rptList.Items[i].FindControl("ltlC_STD_CODE"); //执行标准 Literal ltlzyx1 = (Literal)rptList.Items[i].FindControl("ltlzyx1"); //自由项1 Literal ltlzyx2 = (Literal)rptList.Items[i].FindControl("ltlzyx2"); //自由项2 Literal ltlC_IS_BXG = (Literal)rptList.Items[i].FindControl("ltlC_IS_BXG"); //执行标准 TextBox txtPack_Code = (TextBox)rptList.Items[i].FindControl("txtPack_Code"); //包装要求 TextBox txtC_PRO_USE = (TextBox)rptList.Items[i].FindControl("txtC_PRO_USE"); //产品用途 TextBox txtC_CUST_SQ = (TextBox)rptList.Items[i].FindControl("txtC_CUST_SQ"); //特殊要求 DropDownList dropZL = (DropDownList)rptList.Items[i].FindControl("dropZL"); //质量 HtmlInputText txtWgt = (HtmlInputText)rptList.Items[i].FindControl("txtWgt"); //数量 HtmlInputText txtPrice = (HtmlInputText)rptList.Items[i].FindControl("txtPrice"); //含税单价 if (dropConPolicyArea.SelectedItem.Text != "钢坯") { if (string.IsNullOrEmpty(txtPack_Code.Text) && tqb_pack.Exists(txtPack_Code.Text)) { result = false; break; } } #region //合同明细 Mod_TB_MATRL_MAIN modMat = tb_matrl_main.GetModel(ltlC_ID.Text); Mod_TMO_ORDER modOrder = new Mod_TMO_ORDER(); //订单表 string order_no = randomnumber.CreateOrderNo(conNo); //订单号 modOrder.C_ORDER_NO = order_no; modOrder.C_CON_NO = modCon.C_CON_NO; //合同号 modOrder.C_CON_NAME = modCon.C_CON_NAME; //合同名称 modOrder.C_AREA = modCon.C_AREA; //区域 modOrder.C_INVBASDOCID = modMat.C_PK_INVBASDOC; //存货档案主键 modOrder.C_INVENTORYID = modMat.C_PK_INVMANDOC; //存货管理档案主键 modOrder.C_PROD_NAME = modMat.C_PROD_NAME; //品名 modOrder.C_PROD_KIND = modMat.C_PROD_KIND; //品种 modOrder.C_MAT_CODE = modMat.C_MAT_CODE; //物料编码 modOrder.C_MAT_NAME = modMat.C_MAT_NAME; //物料名称 modOrder.C_SPEC = modMat.C_SPEC; //规格 modOrder.C_STL_GRD = modMat.C_MAT_TYPE == "841" ? modMat.C_MAT_NAME : modMat.C_MAT_TYPE == "851" ? modMat.C_MAT_NAME : modMat.C_STL_GRD; //钢种 modOrder.C_FUNITID = modMat.C_FJLDW; //辅单位 modOrder.C_UNITID = modMat.C_PK_MEASDOC; //主计量单位 modOrder.D_DELIVERY_DT = modCon.D_CONINVALID_DT; //计划交货日期 modOrder.D_DT = modCon.D_CONSING_DT; //订单日期//签单日期 modOrder.C_VDEF1 = dropZL.SelectedItem.Value; //质量主键ID modOrder.C_SFPJ = "N"; modOrder.C_TECH_PROT = ltlC_TECH_PROT.Text; //客户协议号 modOrder.C_FREE1 = ltlzyx1.Text; //自由项1 modOrder.C_FREE2 = ltlzyx2.Text; //自由项2 modOrder.C_STD_CODE = ltlC_STD_CODE.Text; //执行标准 modOrder.C_BY4 = ltlC_IS_BXG.Text; //是否不锈钢 modOrder.N_TYPE = Convert.ToDecimal(modMat.C_MAT_TYPE); //订单类型 modOrder.C_PACK = txtPack_Code.Text.Trim(); //包装要求 Mod_TMB_TAXITEMS modTaxi = tmb_taxitems.GetModel(modMat.C_PK_TAXITEMS); decimal shuolv = Convert.ToDecimal(modTaxi.N_TAXRATIO) >= 1 ? Convert.ToDecimal(modTaxi.N_TAXRATIO) / 100 : Convert.ToDecimal(modTaxi.N_TAXRATIO); //税率 modOrder.N_TAXRATE = shuolv; //税率 decimal N_WGT = 0; if (!string.IsNullOrEmpty(txtWgt.Value)) { N_WGT = Convert.ToDecimal(txtWgt.Value); } modOrder.N_WGT = N_WGT; //数量 modOrder.N_HSL = modMat.N_HSL == null ? 0 : modMat.N_HSL; //换算率 modOrder.N_FNUM = modMat.N_HSL == null ? 1 : N_WGT / modMat.N_HSL; //辅数量 #region //获取钢种单价-税率 if (!string.IsNullOrEmpty(txtPrice.Value)) { decimal N_TAXRATE = Convert.ToDecimal(modOrder.N_TAXRATE) + 1; //税率 decimal N_ORIGINALCURPRICE = Convert.ToDecimal(txtPrice.Value) / N_TAXRATE; //原币无税单价 decimal N_ORIGINALCURTAXPRICE = Convert.ToDecimal(txtPrice.Value); //原币含税单价 decimal N_ORIGINALCURMNY = decimal.Round(N_WGT * N_ORIGINALCURPRICE, 2); //原币无税金额 decimal N_ORIGINALCURSUMMNY = N_WGT * N_ORIGINALCURTAXPRICE; //原币价税合计 decimal N_ORIGINALCURTAXMNY = decimal.Round(N_ORIGINALCURSUMMNY - N_ORIGINALCURMNY, 2); //原币税额 modOrder.N_ORIGINALCURPRICE = N_ORIGINALCURPRICE; //原币无税单价 modOrder.N_ORIGINALCURTAXPRICE = N_ORIGINALCURTAXPRICE; //原币含税单价 modOrder.N_ORIGINALCURTAXMNY = N_ORIGINALCURTAXMNY; //原币税额 modOrder.N_ORIGINALCURMNY = N_ORIGINALCURMNY; //原币无税金额 modOrder.N_ORIGINALCURSUMMNY = N_ORIGINALCURSUMMNY; //原币价税合计 } #endregion modOrder.C_RECEIPTAREAID = modCon.C_CRECEIPTAREAID; //收货地区 modOrder.C_RECEIVEADDRESS = modCon.C_ADDRESS; //收货地址 modOrder.C_RECEIPTCORPID = modCon.C_CRECEIPTCUSTOMERID; //收货单位 modOrder.C_CURRENCYTYPEID = modCon.C_CURRENCYTYPEID; //货币 modOrder.N_USER_LEV = modCon.N_CUST_LEV; //客户等级 modOrder.C_CUST_SQ = txtC_CUST_SQ.Text; //客户要求 modOrder.C_PRO_USE = txtC_PRO_USE.Text; //产品用途 modOrder.C_EMP_ID = modCon.C_EMP_ID; modOrder.C_EMP_NAME = modCon.C_EMP_NAME; modOrder.C_CUST_NO = hidCustNO.Value; modOrder.C_CUST_NAME = txtCustName.Text; modOrder.C_SALE_CHANNEL = ltlCustType.Text; modOrder.C_LEV = GetLev("STL_GRD_Lev"); //钢种等级 modOrder.C_ORDER_LEV = GetLev("Order_Lev"); //订单等级 modOrder.N_COST = 0; //成本 modOrder.C_TRANSMODE = dropShipVia.SelectedItem.Text; //发运方式 modOrder.C_TRANSMODEID = dropShipVia.SelectedItem.Value; //发运方式主键 modOrder.C_YWY = txtSaleUser.Value; //业务员姓名 modOrder.N_STATUS = N_STATUS; orderList.Add(modOrder); #endregion } #endregion return(result == true?tmo_con.InsertConOrder(modCon, orderList) : result); }
private void btn_A3_Click(object sender, EventArgs e) { if (DialogResult.No == MessageBox.Show("确认同步吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } NcRollA1 ncA1 = new NcRollA1(); NcRollA2 ncA2 = new NcRollA2(); NcRollA3 ncA3 = new NcRollA3(); NcRollA4 ncA4 = new NcRollA4(); int errorStatus = 3; string errorId = ""; try { int selectedPlanHandle = this.gv_NC.FocusedRowHandle; //获取计划焦点行索引 int selectedAllowGrd = this.gv_NC.FocusedRowHandle; //获取可轧钢种焦点行索引 if (selectedPlanHandle < 0 || selectedAllowGrd < 0) { MessageBox.Show("请检查计划和可轧钢种,记录为空!"); return; } string id = this.gv_NC.GetRowCellValue(selectedPlanHandle, "C_MAIN_ID").ToString();//获取焦点 errorId = id; var wgd = bll_TRC_ROLL_WGD.GetModel(id, 1); var plan = bllPlanRollItem.GetModel_Item(wgd.C_PLAN_ID); var roll = bll_TRC_ROLL_MAIN.GetModel(wgd.C_MAIN_ID); var a1Sta = bll_TB_STA.GetModel(plan.C_STA_ID); var matrl = bll_TB_MATRL_MAIN.GetModel(plan.C_MAT_CODE); var matrl2 = bll_TB_MATRL_MAIN.GetModel(roll.C_MAT_SLAB_CODE); var main = bll_TRC_ROLL_MAIN.GetModel(id); var a2Sta = bll_TB_STA.GetModel(main.C_STA_ID); DataTable factDt2 = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; for (int j = 0; j < factDt2.Rows.Count; j++) { string slabWh = bll_TPB_LINEWH.GetList_id(factDt2.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); if (string.IsNullOrEmpty(slabWh)) { MessageBox.Show("线材无仓库"); return; } } ncA3.hpch = main.C_BATCH_NO; ncA3.hzdrid = RV.UI.UserInfo.userAccount; ncA3.hwlbmid = matrl.C_PK_INVBASDOC; ncA3.hjldwid = matrl.C_PK_MEASDOC; ncA3.hzdrq = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); ncA3.hfreeitemvalue1 = plan.C_FREE_TERM; ncA3.hfreeitemvalue2 = plan.C_FREE_TERM2; ncA3.hfreeitemvalue3 = plan.C_PACK; DataTable consumeDt = new DataTable(); DataTable a3Dt = bll_TRC_WARM_FURNACE.GetSlabMainInfo(wgd.C_MAIN_ID, out consumeDt); DataTable a3DtZyx = bll_TB_STD_CONFIG.GetZYX(a3Dt.Rows[0]["C_STL_GRD"].ToString(), a3Dt.Rows[0]["C_STD_CODE"].ToString()).Tables[0]; var m = bll_TB_MATRL_MAIN.GetModel(a3Dt.Rows[0]["C_MAT_CODE"].ToString()); ncA3.kgyid = RV.UI.UserInfo.userAccount; ncA3.ckckid = bll_TPB_SLABWH.GetList_id(a3Dt.Rows[0]["c_slabwh_code"].ToString()); ncA3.wlbmid = matrl2.C_PK_INVBASDOC; ncA3.jldwid = matrl2.C_PK_MEASDOC; ncA3.fjldwid = matrl2.C_FJLDW; ncA3.ljcksl = a3Dt.Rows[0]["N_WGT"].ToString(); ncA3.fljcksl = a3Dt.Rows[0]["N_QUA"].ToString(); ncA3.pch = a3Dt.Rows[0]["C_BATCH_NO"].ToString() == "" ? a3Dt.Rows[0]["C_STOVE"].ToString() : a3Dt.Rows[0]["C_BATCH_NO"].ToString(); ncA3.gzzxid = a2Sta.C_ERP_PK; ncA3.freeitemvalue1 = a3Dt.Rows[0]["C_ZYX1"].ToString(); ncA3.freeitemvalue2 = a3Dt.Rows[0]["C_ZYX2"].ToString(); object objOutTime = bll_TRC_WARM_FURNACE.GetOutTime(main.C_ID); ncA3.flrq = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()).ToString("yyyy-MM-dd"); string a3Name = Guid.NewGuid() + "_A3.xml"; if (bll_TRC_ROLL_WGD.IsA3Repeat(main.C_BATCH_NO, "") > 0) { return; } var resultA3 = bll_Interface_NC_Roll_A3.SendXml_ROLL_A3("", a3Name, ncA3, Application.StartupPath); if (resultA3[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(3, id, resultA3[1]); MessageBox.Show("同步失败"); return; } bll_TRC_WARM_FURNACE.ConsumeSlab(consumeDt); if (bll_TRC_ROLL_WGD.UpdateUpLoadStatus(3, id) > 0) { MessageBox.Show("同步成功"); } } catch (Exception ex) { bll_TRC_ROLL_WGD.UpdateIfStatus(errorStatus, errorId, ex.Message); MessageBox.Show("同步失败"); } Bind(); }
private void btn_xf_Click(object sender, EventArgs e) { if (this.icbo_zx3.SelectedIndex < 0) { MessageBox.Show("请选择开坯线!"); this.icbo_zx3.Focus(); return; } int[] rownumber = gridView1.GetSelectedRows();//获取选中行号数组; if (rownumber.Length == 0) { MessageBox.Show("请选择需要下发的计划!"); return; } DataRow row = gridView1.GetDataRow(rownumber[0]); for (int i = 0; i < rownumber.Length; i++) { DataRow dr = gridView1.GetDataRow(rownumber[i]); if (dr["C_STL_GRD"].ToString() != row["C_STL_GRD"].ToString() || dr["C_STD_CODE"].ToString() != row["C_STD_CODE"].ToString() || dr["C_MAT_CODE"].ToString() != row["C_MAT_CODE"].ToString() || dr["C_SPEC"].ToString() != row["C_SPEC"].ToString() || dr["N_LEN"].ToString() != row["N_LEN"].ToString() || dr["C_ZYX1"].ToString() != row["C_ZYX1"].ToString() || dr["C_ZYX2"].ToString() != row["C_ZYX2"].ToString()) { MessageBox.Show("选择需要下发的开坯计划信息不一致,请重新选择!"); return; } } if (string.IsNullOrEmpty(btn_mat_code.Text.Trim()) || string.IsNullOrEmpty(txt_mat_name.Text.Trim()) || string.IsNullOrEmpty(txt_Slab_Size.Text.Trim()) || string.IsNullOrEmpty(txt_Len.Text.Trim()) || string.IsNullOrEmpty(strHsl)) { MessageBox.Show("热轧坯物料编码有误!"); return; } else { if (DialogResult.No == MessageBox.Show("确认下发 物料:" + btn_mat_code.Text.Trim() + "断面:" + txt_Slab_Size.Text.Trim() + "*" + txt_Len.Text.Trim() + "的开坯计划吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } } WaitingFrom.ShowWait(""); for (int i = 0; i < rownumber.Length; i++) { DataRow dr = gridView1.GetDataRow(rownumber[i]); int i_sort = bll_kp.Get_Max_Sort() + 1; Mod_TB_MATRL_MAIN modWl = bll_wl.GetModel(btn_mat_code.Text.Trim()); if (modWl == null) { MessageBox.Show("没有找到热轧坯物料编码,不能下发!"); return; } else { if (modWl.C_STL_GRD != dr["C_STL_GRD"].ToString()) { MessageBox.Show("热轧坯钢种和大方坯钢种不一致,不能下发!"); return; } } Mod_TRP_PLAN_COGDOWN mod = new Mod_TRP_PLAN_COGDOWN(); mod.C_ID = System.Guid.NewGuid().ToString(); mod.N_STATUS = 1; mod.C_INITIALIZE_ITEM_ID = ""; mod.N_SORT = i_sort; mod.N_WGT = Convert.ToDecimal(dr["N_WGT"].ToString()); mod.C_MAT_CODE = btn_mat_code.Text.Trim(); mod.C_MAT_NAME = txt_mat_name.Text.Trim(); mod.C_SPEC = txt_Slab_Size.Text.Trim(); mod.C_STL_GRD = dr["C_STL_GRD"].ToString(); mod.C_STD_CODE = dr["C_STD_CODE"].ToString(); mod.N_LENTH = Convert.ToDecimal(txt_Len.Text.Trim()); try { mod.D_P_START_TIME = RV.UI.ServerTime.timeNow(); mod.D_P_END_TIME = Convert.ToDateTime(mod.D_P_START_TIME).AddHours(Convert.ToDouble(mod.N_WGT / 114)); } catch { } mod.C_STA_ID = this.icbo_zx3.Properties.Items[this.icbo_zx3.SelectedIndex].Value.ToString(); mod.C_CAST_NO = dr["C_STOVE"].ToString(); mod.C_LINE_DESC = this.icbo_zx3.Properties.Items[this.icbo_zx3.SelectedIndex].Description.ToString(); mod.C_FREE1 = dr["C_ZYX1"].ToString(); mod.C_FREE2 = dr["C_ZYX2"].ToString(); mod.C_EMP_ID = RV.UI.UserInfo.userID; mod.D_MOD_DT = RV.UI.ServerTime.timeNow(); mod.N_PW = Convert.ToDecimal(strHsl); mod.C_MATRL_CODE_SLAB = dr["C_MAT_CODE"].ToString(); mod.C_MATRL_NAME_SLAB = dr["C_MAT_NAME"].ToString(); mod.C_SLAB_SIZE = dr["C_SPEC"].ToString(); mod.N_SLAB_LENGTH = Convert.ToDecimal(dr["N_LEN"].ToString()); Mod_TB_MATRL_MAIN modMaterMain = bll_wl.GetModel(dr["C_MAT_CODE"].ToString()); if (modMaterMain != null) { mod.N_SLAB_PW = modMaterMain.N_HSL; } bll_kp.Add(mod); } BindKP(); BindPlan(); WaitingFrom.CloseWait(); }
/// <summary> /// 获取NC正式库数据列表 /// </summary> /// <param name="type">NC正式库/测试</param> /// <returns></returns> public List <Mod_TSC_SLAB_MAIN> Get_GPKNCZS(string type) { DataTable dtnc = null; if (type == "NC正式库") { dtnc = bll_slab.GetNCGPK(); } else { dtnc = bll_slab.GetNCCSGPK(); } List <Mod_TSC_SLAB_MAIN> lst = new List <Mod_TSC_SLAB_MAIN>(); if (dtnc.Rows.Count > 0) { for (int i = 0; i < dtnc.Rows.Count; i++) { string dd = dtnc.Rows[i]["辅数量"].ToString(); int num = 0; try { num = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(dtnc.Rows[i]["辅数量"].ToString())));//支数 } catch (Exception) { num = 10; } string lh = ""; string pch = ""; if (dtnc.Rows[i]["连铸炉号"].ToString().Trim() != "") { lh = dtnc.Rows[i]["连铸炉号"].ToString(); pch = dtnc.Rows[i]["批次号"].ToString(); } else { lh = dtnc.Rows[i]["批次号"].ToString(); pch = ""; } decimal wgt = Convert.ToDecimal(Convert.ToDouble(dtnc.Rows[i]["数量"].ToString())) / Convert.ToDecimal(dtnc.Rows[i]["辅数量"].ToString()); //单重 Mod_TB_MATRL_MAIN motral = bll_matrl.GetModel(dtnc.Rows[i]["INVCODE"].ToString()); string zyx1 = dtnc.Rows[i]["VFREE1"].ToString(); //自由项1 string zyx2 = dtnc.Rows[i]["VFREE2"].ToString(); //自由项2 string bz = zyx1.Split('~')[1].Contains("协议") ? zyx2.Split('~')[1] : zyx1.Split('~')[1]; //执行标准// string zyx3 = dtnc.Rows[i]["VFREE3"].ToString(); //自由项3 DateTime wedate = Convert.ToDateTime(dtnc.Rows[i]["生产入库日期"].ToString()); //生产入库时间 string wlid = dtnc.Rows[i]["INVCODE"].ToString(); //物料编码 string wumc = dtnc.Rows[i]["INVNAME"].ToString(); //物料名称 string hw = dtnc.Rows[i]["STORCODE"].ToString(); //仓库 Mod_TQB_STD_MAIN modbz = bll_bz.GetModel(motral.C_STL_GRD, zyx1, zyx2); for (int j = 0; j < num; j++) { Mod_TSC_SLAB_MAIN mod = new Mod_TSC_SLAB_MAIN(); mod.C_PLAN_ID = type; mod.C_STOVE = lh; mod.C_ID = System.Guid.NewGuid().ToString(); mod.C_BATCH_NO = pch; if (mod.C_STOVE == "24") { mod.C_STA_ID = "890EAA2949E743AFB26C06B8D4209B17"; mod.C_STA_CODE = "3#CC"; mod.C_STA_DESC = "3#铸机"; } else if (mod.C_STOVE == "23") { mod.C_STA_ID = "5263048C90B44B4D9934C513CE028250"; mod.C_STA_CODE = "4#CC"; mod.C_STA_DESC = "4#铸机"; } else if (mod.C_STOVE == "61") { mod.C_STA_ID = "01C145B259E740F6A258AF313DD9268C"; mod.C_STA_CODE = "6#CC"; mod.C_STA_DESC = "6#铸机"; } else { mod.C_STA_ID = "77B9FDA79B884D07AA2B3601D1DA11A2"; mod.C_STA_CODE = "5#CC"; mod.C_STA_DESC = "5#铸机"; } mod.D_WE_DATE = wedate; mod.C_MAT_CODE = wlid; mod.C_MAT_NAME = wumc; mod.C_SPEC = motral.C_SLAB_SIZE;; mod.N_LEN = motral.N_LTH; mod.C_STL_GRD = motral.C_STL_GRD; mod.N_WGT = wgt; mod.C_SCUTCHEON = "白牌"; mod.N_QUA = 1; if (modbz != null) { mod.C_STD_CODE = modbz.C_STD_CODE; } if (mod.C_STD_CODE == "") { mod.C_STD_CODE = bz.Replace(" ", "").Replace("(", "(").Replace(")", ")"); } mod.C_MOVE_TYPE = "M"; mod.D_CCM_DATE = wedate.AddHours(-2); mod.C_STOCK_STATE = "F"; mod.C_MAT_TYPE = "合格品"; mod.C_JUDGE_LEV_ZH = "合格品"; //mod.C_ISXM = "N"; mod.C_ZYX1 = zyx1; mod.C_ZYX2 = zyx2; mod.C_IS_QR = "Y"; mod.C_SLABWH_CODE = hw; lst.Add(mod); } } return(lst); } return(null); }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_Seave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(btnEdit_STL.Text.Trim())) { MessageBox.Show("请选择钢种!"); return; } if (string.IsNullOrEmpty(icbo_lz3.Text.Trim())) { MessageBox.Show("请选择连铸!"); return; } try { Mod_TSP_CAST_PLAN mod = new Mod_TSP_CAST_PLAN(); DataTable dt_Max = bll_cast_plan.GetList_Max(icbo_lz3.EditValue.ToString()).Tables[0]; Mod_TB_MATRL_MAIN mod_matrl = bll_matrl.GetModel(str_ID); mod.C_CCM_ID = icbo_lz3.EditValue.ToString(); mod.C_CCM_CODE = icbo_lz3.Text.Trim(); int group_max = 0; int sort_max = 0; if (dt_Max.Rows[0]["GROUP_MAX"].ToString() == "") { group_max = 1; } else { group_max = (Convert.ToInt32(dt_Max.Rows[0]["GROUP_MAX"].ToString()) + 1); } if (dt_Max.Rows[0]["SORT_MAX"].ToString() == "") { sort_max = 1; } else { sort_max = (Convert.ToInt32(dt_Max.Rows[0]["SORT_MAX"].ToString()) + 1); } mod.C_ID = System.Guid.NewGuid().ToString(); mod.N_GROUP = group_max; mod.N_TOTAL_WGT = Convert.ToInt32(txt_ZJCLS.Text.Trim()); mod.N_ZJCLS = Convert.ToInt32(txt_ZJCLS.Text.Trim()); mod.N_ZJCLZL = Convert.ToInt32(txt_ZJCLS.Text.Trim()) * 77; mod.N_MLZL = 77; mod.N_SORT = sort_max; mod.C_STL_GRD = btnEdit_STL.Text.Trim(); mod.N_JSCN = 144; DataTable dt_SWL = bll_endtoend.GetSWLSteel(btnEdit_STL.Text.Trim(), txt_STD.Text.Trim(), ""); if (dt_SWL.Rows.Count != 0) { mod.C_BY1 = dt_SWL.Rows[0]["C_B_E_STOVE_STEEL"].ToString() + "`" + dt_SWL.Rows[0]["C_BORDER_STD_CODE"].ToString(); } mod.C_BY2 = ""; mod.C_BY3 = ""; mod.C_STD_CODE = txt_STD.Text.Trim(); if (icbo_lz3.Text == "5#铸机" || icbo_lz3.Text == "7#铸机") { mod.C_SLAB_TYPE = "大方坯"; } else { mod.C_SLAB_TYPE = "小方坯"; } mod.C_STL_GRD_TYPE = mod_matrl.C_PROD_KIND; mod.C_PROD_NAME = mod_matrl.C_PROD_NAME; mod.C_REMARK = btnEdit_STL.Text.Trim() + "`" + txt_STD.Text.Trim(); DataTable dtgylx = bll_gylx.GetGYLX(mod.C_STL_GRD, mod.C_STD_CODE, ""); if (dtgylx.Rows.Count > 0) { if (dtgylx.Rows[0]["C_ROUTE_DESC"].ToString().Contains("RH")) { mod.C_RH = "Y"; } else { mod.C_RH = "N"; } if (dtgylx.Rows[0]["C_ROUTE_DESC"].ToString().Contains("XM")) { mod.C_XM = "Y"; } else { mod.C_XM = "N"; } if (dtgylx.Rows[0]["C_ROUTE_DESC"].ToString().Contains("DHL")) { mod.C_DFP_HL = "Y"; } else { mod.C_DFP_HL = "N"; } if (dtgylx.Rows[0]["C_ROUTE_DESC"].ToString().Contains("HL")) { mod.C_HL = "Y"; } else { mod.C_HL = "N"; } if (dtgylx.Rows[0]["C_ROUTE_DESC"].ToString().Contains("TL")) { mod.C_TL = "Y"; } else { mod.C_TL = "N"; } } if (bll_cast_plan.Add(mod)) { for (int l = 0; l < Convert.ToInt32(txt_ZJCLS.Text.Trim()); l++) { Mod_TSP_PLAN_SMS mod_add_lc2 = new Mod_TSP_PLAN_SMS(); mod_add_lc2.C_ID = System.Guid.NewGuid().ToString(); mod_add_lc2.C_FK = mod.C_ID; mod_add_lc2.N_SORT = l; mod_add_lc2.C_STATE = "1"; mod_add_lc2.C_STL_GRD = mod.C_STL_GRD; mod_add_lc2.C_STD_CODE = mod.C_STD_CODE; mod_add_lc2.C_CCM_ID = mod.C_CCM_ID; mod_add_lc2.C_CCM_DESC = mod.C_CCM_CODE; mod_add_lc2.N_SLAB_WGT = mod.N_MLZL; mod_add_lc2.C_SLAB_SIZE = mod_matrl.C_SLAB_SIZE; mod_add_lc2.C_SLAB_LENGTH = mod_matrl.N_LTH.ToString(); mod_add_lc2.N_JC_SORT = mod.N_SORT; mod_add_lc2.C_BY1 = mod.C_BY1; mod_add_lc2.C_ROUTE = txt_GYLX.Text.Trim(); mod_add_lc2.C_FREE1 = txt_ZYX1.Text.Trim(); mod_add_lc2.C_FREE2 = txt_ZYX2.Text.Trim(); mod_add_lc2.C_RH = mod.C_RH; mod_add_lc2.C_DFP_HL = mod.C_DFP_HL; mod_add_lc2.C_HL = mod.C_HL; mod_add_lc2.C_XM = mod.C_XM; mod_add_lc2.C_TL = mod.C_TL; mod_add_lc2.C_BY2 = "手动添加"; bll_Plan_SMS.Add(mod_add_lc2); } } MessageBox.Show("添加成功!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_import_Click(object sender, EventArgs e) { try { WaitingFrom.ShowWait(""); DataTable dt = ReadExcel(this.txtUrl.Text); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { #region 导入订单 string strGUID = System.Guid.NewGuid().ToString(); Mod_TMO_ORDER modorder = new Mod_TMO_ORDER(); modorder.C_ID = System.Guid.NewGuid().ToString(); modorder.C_ORDER_NO = dt.Rows[i]["计划订单号"].ToString(); modorder.D_DT = Convert.ToDateTime(dt.Rows[i]["计划日期"].ToString()); modorder.D_NEED_DT = Convert.ToDateTime(dt.Rows[i]["需求日期"].ToString()); modorder.D_DELIVERY_DT = Convert.ToDateTime(dt.Rows[i]["交货日期"].ToString()); modorder.C_MAT_CODE = dt.Rows[i]["物料编码"].ToString(); modorder.C_STL_GRD = dt.Rows[i]["型号"].ToString(); modorder.C_SPEC = dt.Rows[i]["规格"].ToString(); modorder.C_MAT_NAME = dt.Rows[i]["工艺代码"].ToString(); Mod_TB_MATRL_MAIN modwl = bllwl.GetModel(modorder.C_MAT_CODE); if (modwl != null) { modorder.C_INVBASDOCID = modwl.C_PK_INVBASDOC; modorder.C_MAT_NAME = modwl.C_MAT_NAME; modorder.C_SPEC = modwl.C_SPEC; modorder.C_STL_GRD = modwl.C_STL_GRD; } else { // continue; } modorder.C_FREE1 = dt.Rows[i]["产品标准"].ToString(); modorder.C_FREE2 = dt.Rows[i]["技术要求"].ToString(); Mod_TQB_STD_MAIN modbz = bllbz.GetModel(modorder.C_STL_GRD, modorder.C_FREE1, modorder.C_FREE2); if (modbz != null) { modorder.C_STD_CODE = modbz.C_STD_CODE; } // modorder.C_STD_CODE= modorder.C_PACK = dt.Rows[i]["包装"].ToString(); modorder.N_WGT = Convert.ToDecimal(dt.Rows[i]["需求数量"].ToString()); modorder.C_AREA = dt.Rows[i]["其他要求"].ToString(); modorder.C_TRANSMODE = dt.Rows[i]["内部备注"].ToString(); modorder.C_ORDER_LEV = dt.Rows[i]["订单级别"].ToString(); modorder.C_PRO_USE = dt.Rows[i]["客户用途"].ToString(); modorder.N_PROD_WGT = Convert.ToDecimal(dt.Rows[i]["完工数量"].ToString() == ""?"0": dt.Rows[i]["完工数量"].ToString()); modorder.N_EXEC_STATUS = 0; //订单刚导入状态 modorder.N_TYPE = 8; //线材订单 modorder.N_STATUS = 2; //可执行 modorder.C_REMARK = "导入"; //标志订单是导入的 modorder.C_CON_NO = (Convert.ToInt64(System.DateTime.Now.ToString("yyMMdd") + "0001") + i).ToString(); if (Convert.ToDouble(modorder.N_PROD_WGT) < Convert.ToDouble(modorder.N_WGT) * 0.9) { modorder.N_WGT = modorder.N_WGT - modorder.N_PROD_WGT; bllorder.Add(modorder);//生产量大于90%的视同完成 } #endregion } MessageBox.Show("订单导入成功!"); WaitingFrom.CloseWait(); btn_query_main_Click(null, null); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btn_A3_Click(object sender, EventArgs e) { if (DialogResult.No == MessageBox.Show("确认同步吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1)) { return; } NcRollA2 ncA2 = new NcRollA2(); NcRollA3 ncA3 = new NcRollA3(); NcRollA4 ncA4 = new NcRollA4(); NcRollA1 ncA1 = new NcRollA1(); try { int selectedPlanHandle = this.gv_NC.FocusedRowHandle; //获取计划焦点行索引 int selectedAllowGrd = this.gv_NC.FocusedRowHandle; //获取可轧钢种焦点行索引 if (selectedPlanHandle < 0 || selectedAllowGrd < 0) { MessageBox.Show("请检查计划和可轧钢种,记录为空!"); return; } string id = this.gv_NC.GetRowCellValue(selectedPlanHandle, "C_COGDOWN_ID").ToString();//获取焦点 var main = bll_TRC_COGDOWN_MAIN.GetModel(id); var plan = bll_TRP_PLAN_COGDOWN.GetModel(main.C_PLAN_ID); var matrl = bll_TB_MATRL_MAIN.GetModel(plan.C_MAT_CODE); var matrl2 = bll_TB_MATRL_MAIN.GetModel(main.C_MAT_SLAB_CODE); var product = bll_TRC_COGDOWN_PRODUCT.GetModelByCOGID(id); var a2Sta = bll_TB_STA.GetModel(main.C_STA_ID); #region A3 //int status = 3; ncA3.hpch = main.C_BATCH_NO; ncA3.hzdrid = bll_TRC_COGDOWN_MAIN.GetUser(); ncA3.hwlbmid = matrl.C_PK_INVBASDOC; ncA3.hjldwid = matrl.C_PK_MEASDOC; ncA3.hzdrq = DateTime.Parse(product.D_QR_DATE == null ? DateTime.Now.ToString() : product.D_QR_DATE.ToString()); ncA3.hfreeitemvalue1 = plan.C_FREE1; ncA3.hfreeitemvalue2 = plan.C_FREE2; ncA3.hfreeitemvalue3 = plan.C_PACK; DataTable a3Dt = bll_TRC_COGDOWN_MAIN_ITEM.GetSlabMainInfoKp(main.C_ID); //DataTable a3DtZyx = bll_TB_STD_CONFIG.GetZYX(a3Dt.Rows[0]["C_STL_GRD"].ToString(), a3Dt.Rows[0]["C_STD_CODE"].ToString()).Tables[0]; //var m = GetMatrlModel(a3Dt.Rows[0]["C_MAT_CODE"].ToString()); ncA3.kgyid = bll_TRC_COGDOWN_MAIN.GetUser(); ncA3.ckckid = bll_TPB_SLABWH.GetList_id(a3Dt.Rows[0]["C_SLABWH_CODE"].ToString()).ToString(); ncA3.wlbmid = matrl2.C_PK_INVBASDOC; ncA3.jldwid = matrl2.C_PK_MEASDOC; ncA3.fjldwid = matrl2.C_FJLDW; ncA3.ljcksl = a3Dt.Rows[0]["N_WGT"].ToString(); ncA3.fljcksl = a3Dt.Rows[0]["N_QUA"].ToString(); ncA3.pch = a3Dt.Rows[0]["C_STOVE"].ToString(); ncA3.gzzxid = a2Sta.C_ERP_PK; ncA3.freeitemvalue1 = a3Dt.Rows[0]["C_ZYX1"].ToString(); ncA3.freeitemvalue2 = a3Dt.Rows[0]["C_ZYX2"].ToString(); object objOutTime = bll_TRC_COGDOWN_MAIN.GetOutTimeKp(main.C_ID); ncA3.flrq = product.D_QR_DATE == null?DateTime.Now.ToString() : product.D_QR_DATE.Value.ToString("yyyy-MM-dd"); string a3Name = Guid.NewGuid() + "_A3.xml"; if (bll_TRC_COGDOWN_MAIN.IsA3Repeat(main.C_BATCH_NO, "") > 0) { } var resultA3 = bll_Interface_NC_Roll_A3.SendXml_ROLL_A3("", a3Name, ncA3, Application.StartupPath); if (resultA3[0] != "1") { bll_TRC_COGDOWN_MAIN.UpdateIfStatusCogDown(3, product.C_BATCH_NO, resultA3[1]); bll_TRC_COGDOWN_MAIN.InsertLog(main.C_BATCH_NO, string.Format("计划物料编码:{0},消耗物料编码:{1}", matrl.C_ID, matrl2.C_ID)); MessageBox.Show("同步失败"); return; } #endregion } catch (Exception ex) { MessageBox.Show("同步异常" + ex.ToString()); } Bind(); }
private void btn_A4_Click(object sender, EventArgs e) { NcRollA1 ncA1 = new NcRollA1(); NcRollA2 ncA2 = new NcRollA2(); NcRollA3 ncA3 = new NcRollA3(); NcRollA4 ncA4 = new NcRollA4(); int errorStatus = 4; string errorId = ""; try { int selectedPlanHandle = this.gv_NC.FocusedRowHandle; //获取计划焦点行索引 int selectedAllowGrd = this.gv_NC.FocusedRowHandle; //获取可轧钢种焦点行索引 if (selectedPlanHandle < 0 || selectedAllowGrd < 0) { MessageBox.Show("请检查计划和可轧钢种,记录为空!"); return; } string id = this.gv_NC.GetRowCellValue(selectedPlanHandle, "C_MAIN_ID").ToString();//获取焦点 errorId = id; var wgd = bll_TRC_ROLL_WGD.GetModel(id, 1); var plan = bllPlanRollItem.GetModel_Item(wgd.C_PLAN_ID); var a1Sta = bll_TB_STA.GetModel(plan.C_STA_ID); var matrl = bll_TB_MATRL_MAIN.GetModel(plan.C_MAT_CODE); var main = bll_TRC_ROLL_MAIN.GetModel(id); var a2Sta = bll_TB_STA.GetModel(main.C_STA_ID); DataTable factDt2 = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; for (int j = 0; j < factDt2.Rows.Count; j++) { string slabWh = bll_TPB_LINEWH.GetList_id(factDt2.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); if (string.IsNullOrEmpty(slabWh)) { MessageBox.Show("线材无仓库"); return; } } DataTable a4FactDt = bll_TRC_ROLL_WGD.GetWgdFact(wgd.C_BATCH_NO, 1).Tables[0]; var a4M = bll_TB_MATRL_MAIN.GetModel(wgd.C_MAT_CODE); var a4Sta = bll_TB_STA.GetModel(wgd.C_STA_ID); ncA4.zdrid = RV.UI.UserInfo.userAccount; ncA4.rq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA4.gzzxbmid = a4Sta.C_STA_ERPCODE; ncA4.scbmid = a4Sta.C_SSBMID; ncA4.pch = wgd.C_BATCH_NO; ncA4.wlbmid = a4M.C_PK_INVBASDOC; ncA4.jldwid = a4M.C_PK_MEASDOC; ncA4.gzzxid = a4Sta.C_ERP_PK; ncA4.ccxh = wgd.C_BATCH_NO; ncA4.pk_produce = a4M.C_PK_PRODUCE; ncA4.ksrq = DateTime.Parse(wgd.D_PRODUCE_DATE_B == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_B.ToString()); ncA4.jsrq = DateTime.Parse(wgd.D_PRODUCE_DATE_E == null ? DateTime.Now.ToString() : wgd.D_PRODUCE_DATE_E.ToString()); ncA4.hgsl = a4FactDt.Rows[0]["WGT"].ToString(); ncA4.fhgsl = a4FactDt.Rows[0]["QUA"].ToString(); object wgdHandlerStatus = bll_TRC_ROLL_WGD_HANDLER.GetWgdHandlerStatus(wgd.C_ID); if (wgdHandlerStatus != null) { string status = wgdHandlerStatus.ToString(); ncA4.sflfcp = int.Parse(status) == 2 ? "Y" : "N"; ncA4.sffsgp = int.Parse(status) == 2 ? "Y" : "N"; } else { ncA4.sflfcp = "N"; ncA4.sffsgp = "N"; } ncA4.freeitemvalue1 = wgd.C_FREE_TERM; ncA4.freeitemvalue2 = wgd.C_FREE_TERM2; ncA4.freeitemvalue3 = wgd.C_PACK; string a4Name = Guid.NewGuid() + "_A4.xml"; if (bll_TRC_ROLL_WGD.IsA4Repeat(main.C_BATCH_NO, "") > 0) { return; } var resultA4 = bll_Interface_NC_Roll_A4.SendXml_ROLL_A4("", a4Name, ncA4, Application.StartupPath); if (resultA4[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(4, id, resultA4[1]); MessageBox.Show("同步失败"); return; } errorStatus = 5; DataTable factDt = factDt = bll_TRC_ROLL_WGD.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0]; List <NcRoll46> nc46s = new List <NcRoll46>(); decimal wgdWgt = 0; for (int j = 0; j < factDt.Rows.Count; j++) { NcRoll46 nc46 = new NcRoll46(); var a46M = bll_TB_MATRL_MAIN.GetModel(factDt.Rows[j]["C_MAT_CODE"].ToString()); nc46.cwarehouseid = bll_TPB_LINEWH.GetList_id(factDt.Rows[j]["C_LINEWH_CODE"].ToString()).ToString(); nc46.taccounttime = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); nc46.coperatorid = RV.UI.UserInfo.userAccount; //if (wgd.C_MRSX == "DP") //{ } nc46.ccheckstate_bid = bll_TQB_CHECKSTATE.GetModelByName("DP", "1001").C_ID; //else // nc46.ccheckstate_bid = bll_TQB_CHECKSTATE.GetModelByName(factDt.Rows[j]["C_JUDGE_LEV_BP"].ToString(), "1001").C_ID; nc46.cworkcenterid = bll_TB_STA.Get_NC_ID(wgd.C_STA_ID); nc46.dbizdate = DateTime.Parse(wgd.D_MOD_DT == null ? DateTime.Now.ToString() : wgd.D_MOD_DT.ToString()); nc46.vbatchcode = wgd.C_BATCH_NO; nc46.cinvbasid = a46M.C_PK_INVBASDOC; nc46.pk_produce = a46M.C_PK_PRODUCE; nc46.ninnum = factDt.Rows[j]["WGT"].ToString(); nc46.ninassistnum = factDt.Rows[j]["QUA"].ToString(); nc46.castunitid = a46M.C_FJLDW; nc46.vfree1 = factDt.Rows[j]["C_ZYX1"].ToString(); nc46.vfree2 = factDt.Rows[j]["C_ZYX2"].ToString(); nc46.vfree3 = factDt.Rows[j]["C_BZYQ"].ToString(); nc46s.Add(nc46); wgdWgt += decimal.Parse(factDt.Rows[j]["WGT"].ToString()); } string a46Name = Guid.NewGuid() + "_A46.xml"; if (bll_TRC_ROLL_WGD.Is46Repeat(main.C_BATCH_NO, "") > 0) { return; } var resultA46 = bll_Interface_NC_Roll_46.SendXml_ROLL_46("", a46Name, nc46s, Application.StartupPath); if (resultA46[0] != "1") { bll_TRC_ROLL_WGD.UpdateIfStatus(5, id, resultA46[1]); MessageBox.Show("同步失败"); return; } bll_TRC_ROLL_WGD.UpdateRollPlanItemWgt(plan.C_ID, wgdWgt); if (bll_TRC_ROLL_WGD.UpdateUpLoadStatus(3, id) > 0) { MessageBox.Show("同步成功"); } } catch (Exception ex) { bll_TRC_ROLL_WGD.UpdateIfStatus(errorStatus, errorId, ex.Message); MessageBox.Show("同步失败"); BindWgd(); } BindWgd(); }