コード例 #1
0
        private NcRollA4 GetA4(Mod_TMO_ORDER order, Mod_TB_MATRL_MAIN ordMatrl, Mod_TRC_ROLL_WW_MAIN item, Mod_TB_STA tBSta, Mod_TS_USER user)
        {
            var ncRollA4 = new NcRollA4
            {
                ccxh           = item.C_BATCH_NO,                       //批号
                fhgsl          = (item.N_QUA_REMOVE ?? 0).ToString(),   //完工数量
                freeitemvalue1 = order.C_FREE1,                         //自由项1
                freeitemvalue2 = order.C_FREE2,                         //自由项2
                freeitemvalue3 = order.C_PACK,                          //包装要求
                gzzxbmid       = tBSta.C_STA_ERPCODE,                   //工作中心代码
                gzzxid         = tBSta.C_ERP_PK,                        //工作中心ID
                hgsl           = (item.N_WGT_REMOVE ?? 0).ToString(),   //合格数量
                jldwid         = ordMatrl.C_PK_MEASDOC,                 //计量单位ID
                jsrq           = item.D_PRODUCE_DATE_E ?? DateTime.Now, //生产结束日期
                ksrq           = item.D_PRODUCE_DATE_B ?? DateTime.Now, //生产开始日期
                pch            = item.C_BATCH_NO,                       //批次号,
                pk_produce     = ordMatrl.C_PK_PRODUCE,                 //物料PK
                rq             = item.D_PRODUCE_DATE_E ?? DateTime.Now, //完工日期
                scbmid         = tBSta.C_SSBMID,                        //生产部门ID
                sffsgp         = "N",                                   //是否发生改判
                sflfcp         = "N",                                   //是否联产品
                sj             = DateTime.Now,                          //报告时间
                wlbmid         = ordMatrl.C_PK_INVBASDOC,               //物料编码ID
                zdrid          = user.C_ACCOUNT,                        //item.C_PRODUCE_EMP_ID,//操作人员
            };

            return(ncRollA4);
        }
コード例 #2
0
ファイル: FrmTBWGDA3KP.cs プロジェクト: rcw0125/PCI20200819
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        /// <summary>
        /// 删除线材
        /// </summary>
        /// <param name="ids">主键</param>
        /// <returns></returns>
        public int DelRollProduct(List <string> ids, string batchNo, string path)
        {
            TransactionHelper.BeginTransaction();
            decimal bWgt   = dal.GetRollProductWgt(batchNo);
            string  id     = dal.GetRollMain(batchNo);
            string  planId = "";

            if (dal.DelRollProduct(ids) <= 0)
            {
                TransactionHelper.RollBack();
                return(0);
            }

            NcRollA1 ncA1        = new NcRollA1();
            NcRollA2 ncA2        = new NcRollA2();
            NcRollA3 ncA3        = new NcRollA3();
            NcRollA4 ncA4        = new NcRollA4();
            int      errorStatus = 4;
            string   errorId     = "";

            try
            {
                errorId = id;
                var wgd  = dal.GetModel(id, 1);
                var plan = planDalItem.GetModel_Item(wgd.C_PLAN_ID);
                planId = wgd.C_PLAN_ID;
                var a1Sta = dal_TB_STA.GetModel(plan.C_STA_ID);
                var matrl = dal_TB_MATRL_MAIN.GetModel(plan.C_MAT_CODE);
                var main  = dal_TRC_ROLL_MAIN.GetModel(id);
                var a2Sta = dal_TB_STA.GetModel(main.C_STA_ID);

                //DataTable factDt2 = dal.GetWgdFactAttrDP(wgd.C_BATCH_NO).Tables[0];
                //for (int j = 0; j < factDt2.Rows.Count; j++)
                //{
                //    string slabWh = dal_TPB_LINEWH.GetList_id(factDt2.Rows[j]["C_LINEWH_CODE"].ToString()).ToString();
                //    if (string.IsNullOrEmpty(slabWh))
                //    {
                //        return 0;
                //    }
                //}

                DataTable a4FactDt = dal.GetWgdFactTran(wgd.C_BATCH_NO, 1, ids).Tables[0];
                var       a4M      = dal_TB_MATRL_MAIN.GetModel(wgd.C_MAT_CODE);
                var       a4Sta    = dal_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 = wgdHandlerDal.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 (dal.IsA4Repeat(main.C_BATCH_NO, "") > 0)
                {
                    TransactionHelper.RollBack();
                    return(0);
                }
                var resultA4 = dal_Interface_NC_Roll_A4.SendXml_ROLL_A4("", a4Name, ncA4, path);
                if (resultA4[0] != "1")
                {
                    dal.UpdateIfStatus(4, id, resultA4[1]);
                    TransactionHelper.RollBack();
                    return(0);
                }

                errorStatus = 5;
                DataTable       factDt = factDt = dal.GetWgdFactAttrDPTran(wgd.C_BATCH_NO, ids).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 = dal_TB_MATRL_MAIN.GetModel(factDt.Rows[j]["C_MAT_CODE"].ToString());
                    nc46.cwarehouseid = dal_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 = dal_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 = dal_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 (dal.Is46Repeat(main.C_BATCH_NO, "") > 0)
                {
                    TransactionHelper.RollBack();
                    return(0);
                }
                var resultA46 = dal_Interface_NC_Roll_46.SendXml_ROLL_46("", a46Name, nc46s, path);
                if (resultA46[0] != "1")
                {
                    dal.UpdateIfStatus(5, id, resultA46[1]);
                    TransactionHelper.RollBack();
                    return(0);
                }
                TransactionHelper.Commit();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                dal.UpdateIfStatus(errorStatus, errorId, ex.Message);
            }

            decimal eWgt = dal.GetRollProductWgt(batchNo);

            dal.UpdateRollPlanItemWgt(planId, bWgt, 1);
            dal.UpdateRollPlanItemWgt(planId, eWgt);
            return(1);
        }
コード例 #5
0
 public List <string> SendXml_ROLL_A4(string dayplcode, string xmlFileName, NcRollA4 nc, string path)
 {
     return(dal.SendXml_ROLL_A4(dayplcode, xmlFileName, nc, path));
 }
コード例 #6
0
        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();
        }
コード例 #7
0
        //private readonly Dal_TB_NCIF_LOG dal_TB_NCIF_LOG = new Dal_TB_NCIF_LOG();

        public List <string> SendXml_ROLL_A4(string c_id, string pch, string xmlFileName, NcRollA4 nc, string path)
        {
            try
            {
                string url = path + $"\\NCXML\\{c_id}";
                if (!Directory.Exists(url))
                {
                    Directory.CreateDirectory(url);
                }

                // Mod_TMO_CON modCon = tmo_con.GetModel(pch);
                XmlDocument xmlDoc = new XmlDocument();
                //创建类型声明节点
                XmlNode node = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "no");
                xmlDoc.AppendChild(node);

                //创建根节点
                XmlElement root = xmlDoc.CreateElement("ufinterface");
                #region//给节点属性赋值
                root.SetAttribute("billtype", "AM");
                root.SetAttribute("filename", "" + pch + ".xml");
                root.SetAttribute("isexchange", "Y");
                root.SetAttribute("operation", "req");
                root.SetAttribute("proc", "add");
                root.SetAttribute("receiver", "101");
                root.SetAttribute("replace", "Y");
                root.SetAttribute("roottag", "bill");
                root.SetAttribute("sender", "1107");
                #endregion
                xmlDoc.AppendChild(root);

                //创建子根节点
                XmlElement bill = xmlDoc.CreateElement("bill");
                #region//节点属性
                bill.SetAttribute("id", nc.pch);
                #endregion
                root.AppendChild(bill);

                XmlNode head = xmlDoc.CreateNode(XmlNodeType.Element, "bill_head", null);

                #region                                                       //表头_order_head

                CreateNode(xmlDoc, head, "zdrid", nc.zdrid);                  //制单人
                CreateNode(xmlDoc, head, "rq", nc.rq.ToString("yyyy-MM-dd")); //日期
                CreateNode(xmlDoc, head, "sj", nc.rq.ToString("HH:mm:ss"));   //报告时间
                CreateNode(xmlDoc, head, "gzzxbmid", nc.gzzxbmid);            //工作中心编码ID
                CreateNode(xmlDoc, head, "scbmid", nc.scbmid);                //生产部门ID

                #endregion

                bill.AppendChild(head);
                XmlElement body = xmlDoc.CreateElement("bill_body");
                bill.AppendChild(body);


                XmlNode item = xmlDoc.CreateNode(XmlNodeType.Element, "item", null);
                #region                                                           //表体_item

                CreateNode(xmlDoc, item, "pch", nc.pch);                          //批次号
                CreateNode(xmlDoc, item, "scddh", "");                            //生产订单号
                CreateNode(xmlDoc, item, "wlbmid", nc.wlbmid);                    //物料编码ID
                CreateNode(xmlDoc, item, "jldwid", nc.jldwid);                    //计量单位ID
                CreateNode(xmlDoc, item, "gzzxid", nc.gzzxid);                    //工作中心ID
                CreateNode(xmlDoc, item, "ccxh", nc.pch);                         //产出序号
                CreateNode(xmlDoc, item, "gxh", "");                              //工序号
                CreateNode(xmlDoc, item, "pk_produce", nc.pk_produce);            //物料PK
                CreateNode(xmlDoc, item, "ksrq", nc.ksrq.ToString("yyyy-MM-dd")); //开始日期
                CreateNode(xmlDoc, item, "kssj", nc.ksrq.ToString("HH:mm:ss"));   //开始时间
                CreateNode(xmlDoc, item, "jsrq", nc.jsrq.ToString("yyyy-MM-dd")); //结束日期
                CreateNode(xmlDoc, item, "jssj", nc.jsrq.ToString("HH:mm:ss"));   //结束时间
                CreateNode(xmlDoc, item, "hgsl", nc.hgsl);                        //合格数量
                CreateNode(xmlDoc, item, "fhgsl", nc.fhgsl);                      //辅合格数量
                CreateNode(xmlDoc, item, "sflfcp", nc.sffsgp);                    //是否联副产品
                CreateNode(xmlDoc, item, "sffsgp", nc.sffsgp);                    //是否发生改判
                CreateNode(xmlDoc, item, "zdy1", "");                             //自定义项1
                CreateNode(xmlDoc, item, "zdy2", "");                             //自定义项2
                CreateNode(xmlDoc, item, "zdy3", "");                             //自定义项3
                CreateNode(xmlDoc, item, "zdy4", "");                             //自定义项4
                CreateNode(xmlDoc, item, "zdy5", "");                             //自定义项5
                CreateNode(xmlDoc, item, "freeitemvalue1", nc.freeitemvalue1);
                CreateNode(xmlDoc, item, "freeitemvalue2", nc.freeitemvalue2);
                CreateNode(xmlDoc, item, "freeitemvalue3", nc.freeitemvalue3);
                CreateNode(xmlDoc, item, "freeitemvalue4", "");
                CreateNode(xmlDoc, item, "freeitemvalue5", ""); //PCI计划订单主键
                CreateNode(xmlDoc, item, "pk_corp", "");        //公司编码
                CreateNode(xmlDoc, item, "gcbm", "");           //工厂

                #endregion

                body.AppendChild(item);

                xmlDoc.Save(url + "\\" + xmlFileName);

                if (NCConfig.IsSendToNC)
                {
                    List <string> result = SendXML(url + "\\" + xmlFileName);
                    //Mod_TB_NCIF_LOG log = new Mod_TB_NCIF_LOG();
                    //log.C_TYPE = "A4";
                    //log.C_RESULT = result[0];
                    //log.C_REMARK = result[1];
                    //log.C_RELATIONSHIP_ID = nc.pch;
                    //dal_TB_NCIF_LOG.Add(log);
                    return(result);
                }

                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #8
0
ファイル: FrmRC_TBWGD5.cs プロジェクト: rcw0125/PCI20200819
        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();
        }