Ejemplo n.º 1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Mod_TRC_ROLL_WGD model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 2
0
        private void AddLog(string stove, string batchNo, string planID, int num, decimal wgt, string grd, string spec, string std, string id, string staID, DateTime start, DateTime end, string shift, string group, Mod_TRC_ROLL_WGD model, Mod_TRP_PLAN_ROLL_ITEM planM, DataTable dt)
        {
            Mod_TRC_ROLL_WGD_LOG modelLog = new Mod_TRC_ROLL_WGD_LOG();

            modelLog.C_ID             = Guid.NewGuid().ToString();
            modelLog.C_STA_ID         = staID;
            modelLog.C_STOVE          = stove;
            modelLog.C_BATCH_NO       = batchNo;
            modelLog.C_PLAN_ID        = planID;
            modelLog.N_QUA_PRODUCE    = num;
            modelLog.N_WGT_PRODUCE    = wgt;
            modelLog.N_STATUS         = 2;
            modelLog.C_STD_CODE       = std;
            modelLog.C_STL_GRD        = grd;
            modelLog.C_SPEC           = spec;
            modelLog.C_MAIN_ID        = id;
            modelLog.D_PRODUCE_DATE_B = start;
            modelLog.D_PRODUCE_DATE_E = end;
            modelLog.C_PRODUCE_SHIFT  = shift;
            modelLog.C_PRODUCE_GROUP  = group;
            modelLog.C_PRODUCE_EMP_ID = RV.UI.UserInfo.userID;
            modelLog.D_MOD_DT         = DateTime.Now;
            modelLog.D_PRODUCE_DATE   = model.D_PRODUCE_DATE_B;
            modelLog.C_FREE_TERM      = planM.C_FREE_TERM;
            modelLog.C_FREE_TERM2     = planM.C_FREE_TERM2;
            modelLog.C_PACK           = planM.C_PACK;
            modelLog.C_AREA           = planM.C_AREA;
            modelLog.C_PCLX           = planM.C_PCLX;
            modelLog.C_MAT_CODE       = planM.C_MAT_CODE;
            modelLog.C_MAT_DESC       = planM.C_MAT_NAME;
            wgdDalLog.Add(modelLog);

            if (dt != null && dt.Rows.Count > 0)
            {
                Mod_TRC_ROLL_WGD_ITEM_LOG itemM = new Mod_TRC_ROLL_WGD_ITEM_LOG();
                itemM.C_MAIN_ID     = model.C_MAIN_ID;
                itemM.C_ROLL_WGD_ID = model.C_ID;
                itemM.C_BATCH_NO    = batchNo;
                itemM.N_STATUS      = 2;
                itemM.C_STL_GRD     = model.C_STL_GRD;
                itemM.C_STD_CODE    = model.C_STD_CODE;
                itemM.C_SPEC        = model.C_SPEC;
                itemM.C_MAT_CODE    = planM.C_MAT_CODE;
                itemM.C_MAT_DESC    = planM.C_MAT_NAME;
                itemM.C_ZYX1        = planM.C_FREE_TERM;
                itemM.C_ZYX2        = planM.C_FREE_TERM2;
                itemM.C_BZYQ        = model.C_PACK;
                itemM.C_SALE_AREA   = model.C_AREA;
                wgdItemDalLog.Add(itemM);

                foreach (DataRow item in dt.Rows)
                {
                    Mod_TRC_ROLL_WGD_ITEM_LOG itemMM = new Mod_TRC_ROLL_WGD_ITEM_LOG();
                    itemMM.C_MAIN_ID     = model.C_MAIN_ID;
                    itemMM.C_ROLL_WGD_ID = model.C_ID;
                    itemMM.C_BATCH_NO    = batchNo;
                    itemMM.N_STATUS      = 2;
                    itemMM.C_STL_GRD     = item["钢种"].ToString();
                    itemMM.C_STD_CODE    = item["执行标准"].ToString();
                    itemMM.C_SPEC        = item["规格"].ToString();
                    itemMM.C_MAT_CODE    = item["物料编码"].ToString();
                    itemMM.C_MAT_DESC    = item["物料名称"].ToString();
                    itemMM.C_ZYX1        = item["自由项1"].ToString();
                    itemMM.C_ZYX2        = item["自由项2"].ToString();
                    itemMM.C_BZYQ        = model.C_PACK;
                    itemMM.C_SALE_AREA   = model.C_AREA;
                    wgdItemDalLog.Add(itemMM);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 完工单确认
        /// </summary>
        /// <param name="stove">炉号</param>
        /// <param name="batchNo">批号</param>
        /// <param name="planID">计划id</param>
        /// <param name="num">支数</param>
        /// <param name="wgt">重量</param>
        /// <param name="grd">钢种</param>
        /// <param name="spec">规格</param>
        /// <param name="std">执行标准</param>
        /// <param name="id">主表id</param>
        /// <param name="staID">工位号</param>
        /// <param name="start">start</param>
        /// <param name="end">start</param>
        /// <param name="shift">班次ID</param>
        /// <param name="group">班组ID</param>
        /// <param name="shiftName">班次</param>
        /// <param name="groupName">班组</param>
        /// <param name="castOffQua">甩废</param>
        /// <param name="cuttingQua">切废</param>
        /// <returns></returns>
        public string WgdHandler(string stove, string batchNo, string planID, int num,
                                 decimal wgt, string grd, string spec, string std, string id, string staID, DateTime start, DateTime end
                                 , string shift, string group, string shiftName, string groupName, string castOffQua, string cuttingQua)
        {
            string result = "1";

            try
            {
                TransactionHelper.BeginTransaction();
                decimal successQua = num - decimal.Parse(castOffQua) - decimal.Parse(cuttingQua);
                wgdDal.UpdateWgd(start, end, num, id, decimal.Parse(castOffQua), decimal.Parse(cuttingQua), successQua, shift, group, shiftName, groupName);

                if (!wgdDal.UpdateRollStatus(id, 1))
                {
                    TransactionHelper.RollBack();
                    return("0");
                }

                if (dal_TRC_WARM_FURNACE.UpdateWarmFurnaceRolleState(id, 3, 2) == 0)
                {
                    TransactionHelper.RollBack();
                    return("0");
                }

                TransactionHelper.Commit();

                #region 日志模型
                Mod_TRC_ROLL_WGD model = new Mod_TRC_ROLL_WGD();
                var planM = planRollItem.GetModel_Item(planID);
                model.C_ID                 = Guid.NewGuid().ToString();
                model.C_STA_ID             = staID;
                model.C_STOVE              = stove;
                model.C_BATCH_NO           = batchNo;
                model.C_PLAN_ID            = planID;
                model.N_QUA_PRODUCE        = num;
                model.N_WGT_PRODUCE        = wgt;
                model.N_STATUS             = 0;
                model.C_STD_CODE           = std;
                model.C_STL_GRD            = grd;
                model.C_SPEC               = spec;
                model.C_MAIN_ID            = id;
                model.D_PRODUCE_DATE_B     = start;
                model.D_PRODUCE_DATE_E     = RV.UI.ServerTime.timeNow();
                model.C_PRODUCE_SHIFT      = shift;
                model.C_PRODUCE_GROUP      = group;
                model.C_PRODUCE_EMP_ID     = RV.UI.UserInfo.userID;
                model.D_MOD_DT             = start;
                model.D_PRODUCE_DATE       = model.D_PRODUCE_DATE_B;
                model.C_FREE_TERM          = planM.C_FREE_TERM;
                model.C_FREE_TERM2         = planM.C_FREE_TERM2;
                model.C_PACK               = planM.C_PACK;
                model.C_AREA               = planM.C_AREA;
                model.C_PCLX               = planM.C_PCLX;
                model.C_MAT_CODE           = planM.C_MAT_CODE;
                model.C_MAT_DESC           = planM.C_MAT_NAME;
                model.C_PRODUCE_SHIFT_NAME = shiftName;
                model.C_PRODUCE_GROUP_NAME = groupName;


                Mod_TRC_ROLL_WGD_ITEM itemM = new Mod_TRC_ROLL_WGD_ITEM();
                itemM.C_MAIN_ID     = model.C_MAIN_ID;
                itemM.C_ROLL_WGD_ID = model.C_ID;
                itemM.C_BATCH_NO    = batchNo;
                itemM.N_STATUS      = 0;
                itemM.C_STL_GRD     = model.C_STL_GRD;
                itemM.C_STD_CODE    = model.C_STD_CODE;
                itemM.C_SPEC        = model.C_SPEC;
                itemM.C_MAT_CODE    = planM.C_MAT_CODE;
                itemM.C_MAT_DESC    = planM.C_MAT_NAME;
                itemM.C_ZYX1        = planM.C_FREE_TERM;
                itemM.C_ZYX2        = planM.C_FREE_TERM2;
                itemM.C_BZYQ        = model.C_PACK;
                itemM.C_SALE_AREA   = model.C_AREA;
                itemM.C_MRSX        = model.C_MRSX;

                DataTable dt = wgdDal.Get_Item_List(planM.C_MAT_CODE).Tables[0];
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        Mod_TRC_ROLL_WGD_ITEM itemMM = new Mod_TRC_ROLL_WGD_ITEM();
                        itemMM.C_MAIN_ID     = model.C_MAIN_ID;
                        itemMM.C_ROLL_WGD_ID = model.C_ID;
                        itemMM.C_BATCH_NO    = batchNo;
                        itemMM.N_STATUS      = 0;
                        itemMM.C_STL_GRD     = item["钢种"].ToString();
                        itemMM.C_STD_CODE    = item["执行标准"].ToString();
                        itemMM.C_SPEC        = item["规格"].ToString();
                        itemMM.C_MAT_CODE    = item["物料编码"].ToString();
                        itemMM.C_MAT_DESC    = item["物料名称"].ToString();
                        itemMM.C_ZYX1        = item["自由项1"].ToString();
                        itemMM.C_ZYX2        = item["自由项2"].ToString();
                        itemMM.C_BZYQ        = model.C_PACK;
                        itemMM.C_SALE_AREA   = model.C_AREA;
                        itemMM.C_MRSX        = model.C_MRSX;
                    }
                }
                #endregion

                AddLog(stove, batchNo, planID, num, wgt, grd, spec, std, id, staID, start, end, shift, group, model, planM, dt);
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                return("0");
            }
            return(result);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Mod_TRC_ROLL_WGD model)
 {
     return(dal.Add(model));
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 线材综合判定确认
        /// </summary>
        /// <param name="strBatchNo">批号</param>
        /// <param name="strUrl">xml地址</param>
        /// <returns></returns>
        public string Roll_Compre_OK(string strBatchNo, string strUrl)
        {
            string result = "1";

            try
            {
                Dal_TRC_ROLL_PRODCUT                 dalTrcRollProduct       = new Dal_TRC_ROLL_PRODCUT();
                Dal_TRC_ROLL_WGD                     dalTrcRollWgd           = new Dal_TRC_ROLL_WGD();
                Dal_TQC_ROLL_COMMUTE                 DalTqcRollCommute       = new Dal_TQC_ROLL_COMMUTE();
                Dal_Interface_NC_Roll_KC4N_ZP        dal_interface           = new Dal_Interface_NC_Roll_KC4N_ZP();
                Dal_Interface_NC_Roll_KC4N_ZP_No_WGD dal_interface_No_Wgd    = new Dal_Interface_NC_Roll_KC4N_ZP_No_WGD();
                Dal_TQR_ZBS_ITEM                     dalTqrZbsItem           = new Dal_TQR_ZBS_ITEM();
                Dal_TQC_COMPRE_ITEM_RESULT           dalTqcCompreItemResult  = new Dal_TQC_COMPRE_ITEM_RESULT();
                Dal_TQC_PHYSICS_RESULT_MAIN          dalTqcPhysicsResultMain = new Dal_TQC_PHYSICS_RESULT_MAIN();

                TransactionHelper.BeginTransaction();
                TransactionHelper_SQL.BeginTransaction();

                string   strUserID = RV.UI.UserInfo.userID;
                DateTime time      = RV.UI.ServerTime.timeNow();

                string C_MASTER_ID    = "";
                string C_GP_BEFORE_ID = "";
                string C_GP_AFTER_ID  = "";

                DataTable dt_CompreRoll = dal.Get_List(strBatchNo).Tables[0];

                if (dt_CompreRoll.Rows.Count > 0)
                {
                    int num = 0;
                    for (int i = 0; i < dt_CompreRoll.Rows.Count; i++)
                    {
                        num++;

                        Mod_TQC_COMPRE_ROLL modTqcCompreRoll = dal.GetModel(dt_CompreRoll.Rows[i]["C_ID"].ToString());

                        if (!string.IsNullOrEmpty(modTqcCompreRoll.C_RESULT_PEOPLE) || !string.IsNullOrEmpty(modTqcCompreRoll.C_RESULT_ALL))
                        {
                            //判定结果回写实绩表
                            string strResult = "";
                            if (!string.IsNullOrEmpty(modTqcCompreRoll.C_RESULT_PEOPLE))
                            {
                                strResult = modTqcCompreRoll.C_RESULT_PEOPLE;
                            }
                            else
                            {
                                strResult = modTqcCompreRoll.C_RESULT_ALL;
                            }

                            if (strResult == "N")
                            {
                                TransactionHelper.RollBack();
                                TransactionHelper_SQL.RollBack();
                                return("综判等级为N,请选择人工判定等级!");
                            }

                            modTqcCompreRoll.C_QR_STATE = "Y";
                            modTqcCompreRoll.C_EMP_ID   = strUserID;
                            modTqcCompreRoll.D_MOD_DT   = time;

                            if (!dal.Update_Trans(modTqcCompreRoll))
                            {
                                TransactionHelper.RollBack();
                                TransactionHelper_SQL.RollBack();
                                return("操作失败!");
                            }

                            DataTable dt = DalTqcRollCommute.GetList_max_Trans().Tables[0];

                            if (string.IsNullOrEmpty(dt.Rows[0]["C_GP_AFTER_ID"].ToString()))
                            {
                                C_GP_AFTER_ID = "ph" + time.ToString("yyMMdd00001");
                            }
                            else
                            {
                                C_GP_AFTER_ID = "ph" + (Convert.ToInt64(dt.Rows[0]["C_GP_AFTER_ID"].ToString()) + 1).ToString();
                            }

                            if (!dalTrcRollProduct.Update_Trans(strResult, modTqcCompreRoll.C_EMP_ID, modTqcCompreRoll, C_GP_AFTER_ID))
                            {
                                TransactionHelper.RollBack();
                                TransactionHelper_SQL.RollBack();
                                return("操作失败!");
                            }
                        }
                        else
                        {
                            TransactionHelper.RollBack();
                            TransactionHelper_SQL.RollBack();
                            return("请先选择人工判定等级!");
                        }
                    }

                    int num_main = dalTqcPhysicsResultMain.Get_Count(strBatchNo);

                    if (num_main > 0)
                    {
                        if (!dalTqcPhysicsResultMain.Update_PD_Trans(strBatchNo))
                        {
                            TransactionHelper.RollBack();
                            TransactionHelper_SQL.RollBack();
                            return("更新判定状态失败!");
                        }
                    }

                    if (num == dt_CompreRoll.Rows.Count)
                    {
                        #region  步重量

                        DataTable dtTM = dal.Get_TM_List(strBatchNo).Tables[0];
                        if (dtTM.Rows.Count > 0)
                        {
                            for (int i = 0; i < dtTM.Rows.Count; i++)
                            {
                                if (!dalTrcRollProduct.Update_Wgt_Trans(strBatchNo, dtTM.Rows[i]["GH"].ToString(), dtTM.Rows[i]["ZL"].ToString()))
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("更新重量失败!");
                                }
                            }
                        }
                        else
                        {
                            TransactionHelper.RollBack();
                            TransactionHelper_SQL.RollBack();
                            return("没有找到条码库存信息,判定失败!");
                        }

                        #endregion

                        Mod_TRC_ROLL_WGD mod_wgd = dalTrcRollWgd.Get_WGD_Modle(strBatchNo);//获取完工单信息
                        if (mod_wgd != null)
                        {
                            DataTable dt_Group = dalTrcRollProduct.Get_List_ByGroup(strBatchNo).Tables[0];

                            for (int i = 0; i < dt_Group.Rows.Count; i++)
                            {
                                #region 更新线材实绩表

                                DataTable dt = DalTqcRollCommute.GetList_max_MasterID_Trans().Tables[0];

                                if (string.IsNullOrEmpty(dt.Rows[0]["C_MASTER_ID"].ToString()))
                                {
                                    C_MASTER_ID = "sj" + time.ToString("yyMMdd00001");
                                }
                                else
                                {
                                    C_MASTER_ID = "sj" + (Convert.ToInt64(dt.Rows[0]["C_MASTER_ID"].ToString()) + 1).ToString();
                                }

                                if (string.IsNullOrEmpty(dt.Rows[0]["C_GP_BEFORE_ID"].ToString()))
                                {
                                    C_GP_BEFORE_ID = "pq" + time.ToString("yyMMdd00001");
                                }
                                else
                                {
                                    C_GP_BEFORE_ID = "pq" + (Convert.ToInt64(dt.Rows[0]["C_GP_BEFORE_ID"].ToString()) + 1).ToString();
                                }

                                if (!dalTrcRollProduct.Update_Trans(C_MASTER_ID, C_GP_BEFORE_ID, dt_Group.Rows[i]["C_STD_CODE"].ToString(), dt_Group.Rows[i]["C_MAT_CODE"].ToString(), dt_Group.Rows[i]["C_ZYX1"].ToString(), dt_Group.Rows[i]["C_ZYX2"].ToString(), strBatchNo))
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("操作失败!");
                                }

                                #endregion

                                #region   条码

                                DataTable dt_Details = dalTrcRollProduct.Get_Details(strBatchNo, dt_Group.Rows[i]["C_STD_CODE"].ToString(), dt_Group.Rows[i]["C_MAT_CODE"].ToString(), dt_Group.Rows[i]["C_ZYX1"].ToString(), dt_Group.Rows[i]["C_ZYX2"].ToString()).Tables[0];


                                if (dt_Details.Rows.Count > 0)
                                {
                                    string sql = "";

                                    for (int kk = 0; kk < dt_Details.Rows.Count; kk++)
                                    {
                                        if (mod_wgd.C_MRSX.ToString() == "DP")
                                        {
                                            sql = "insert into ReZJB_GPD(Barcode,WGDH,CK,HW,PCH,WLH,WLMC,SX,PH,GG,BB,GH,ZL,BZ,RQ,RKType,RKRY,WeightRQ,ProduceData,PCInfo,vfree0,vfree3,GPTYPE,ZJBstatus,CAPPK,insertts,vfree1,vfree2) values('" + dt_Details.Rows[kk]["C_BARCODE"] + "','" + dt_Details.Rows[kk]["C_TRC_ROLL_MAIN_ID"] + "','" + dt_Details.Rows[kk]["C_LINEWH_CODE"] + "','" + dt_Details.Rows[kk]["C_LINEWH_LOC_CODE"] + "','" + dt_Details.Rows[kk]["C_BATCH_NO"] + "','" + dt_Details.Rows[kk]["C_MAT_CODE"] + "','" + dt_Details.Rows[kk]["C_MAT_DESC"] + "','" + dt_Details.Rows[kk]["C_JUDGE_LEV_ZH"] + "','" + dt_Details.Rows[kk]["C_STL_GRD"] + "','" + dt_Details.Rows[kk]["C_SPEC"] + "mm','" + dt_Details.Rows[kk]["C_GROUP"] + "','" + dt_Details.Rows[kk]["C_TICK_NO"] + "','" + dt_Details.Rows[kk]["N_WGT"] + "','" + dt_Details.Rows[kk]["C_STD_CODE"] + "','" + dt_Details.Rows[kk]["D_RKRQ"] + "','" + dt_Details.Rows[kk]["C_MOVE_DESC"] + "','" + dt_Details.Rows[kk]["C_RKRY"] + "','" + dt_Details.Rows[kk]["D_WEIGHT_DT"] + "','" + dt_Details.Rows[kk]["D_PRODUCE_DATE"] + "','" + dt_Details.Rows[kk]["C_PCINFO"] + "','" + dt_Details.Rows[kk]["C_STOVE"] + "','" + dt_Details.Rows[kk]["C_BZYQ"] + "','','0','" + dt_Details.Rows[kk]["C_ID"] + "','" + time + "','" + dt_Details.Rows[kk]["C_ZYX1"].ToString() + "','" + dt_Details.Rows[kk]["C_ZYX2"].ToString() + "')";

                                            if (TransactionHelper_SQL.ExecuteSql(sql) == 0)
                                            {
                                                TransactionHelper.RollBack();
                                                TransactionHelper_SQL.RollBack();
                                                return("信息传到条码时出错!");
                                            }
                                        }
                                        else
                                        {
                                            if (dt_Details.Rows[kk]["C_JUDGE_LEV_BP"].ToString() != dt_Details.Rows[kk]["C_JUDGE_LEV_ZH"].ToString())
                                            {
                                                sql = "insert into ReZJB_GPD(Barcode,WGDH,CK,HW,PCH,WLH,WLMC,SX,PH,GG,BB,GH,ZL,BZ,RQ,RKType,RKRY,WeightRQ,ProduceData,PCInfo,vfree0,vfree3,GPTYPE,ZJBstatus,CAPPK,insertts,vfree1,vfree2) values('" + dt_Details.Rows[kk]["C_BARCODE"] + "','" + dt_Details.Rows[kk]["C_TRC_ROLL_MAIN_ID"] + "','" + dt_Details.Rows[kk]["C_LINEWH_CODE"] + "','" + dt_Details.Rows[kk]["C_LINEWH_LOC_CODE"] + "','" + dt_Details.Rows[kk]["C_BATCH_NO"] + "','" + dt_Details.Rows[kk]["C_MAT_CODE"] + "','" + dt_Details.Rows[kk]["C_MAT_DESC"] + "','" + dt_Details.Rows[kk]["C_JUDGE_LEV_ZH"] + "','" + dt_Details.Rows[kk]["C_STL_GRD"] + "','" + dt_Details.Rows[kk]["C_SPEC"] + "mm','" + dt_Details.Rows[kk]["C_GROUP"] + "','" + dt_Details.Rows[kk]["C_TICK_NO"] + "','" + dt_Details.Rows[kk]["N_WGT"] + "','" + dt_Details.Rows[kk]["C_STD_CODE"] + "','" + dt_Details.Rows[kk]["D_RKRQ"] + "','" + dt_Details.Rows[kk]["C_MOVE_DESC"] + "','" + dt_Details.Rows[kk]["C_RKRY"] + "','" + dt_Details.Rows[kk]["D_WEIGHT_DT"] + "','" + dt_Details.Rows[kk]["D_PRODUCE_DATE"] + "','" + dt_Details.Rows[kk]["C_PCINFO"] + "','" + dt_Details.Rows[kk]["C_STOVE"] + "','" + dt_Details.Rows[kk]["C_BZYQ"] + "','','0','" + dt_Details.Rows[kk]["C_ID"] + "','" + time + "','" + dt_Details.Rows[kk]["C_ZYX1"].ToString() + "','" + dt_Details.Rows[kk]["C_ZYX2"].ToString() + "')";

                                                if (TransactionHelper_SQL.ExecuteSql(sql) == 0)
                                                {
                                                    TransactionHelper.RollBack();
                                                    TransactionHelper_SQL.RollBack();
                                                    return("信息传到条码时出错!");
                                                }
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("信息传到条码时出错!");
                                }

                                #endregion

                                #region   NC

                                string sql_NC  = "select count(distinct t.STORCODE) from XGERP50.V_ONHAND_XC t where t.批次号='" + strBatchNo + "' AND T.INVTYPE='" + dt_Group.Rows[i]["C_STL_GRD"].ToString() + "' AND T.INVCODE='" + dt_Group.Rows[i]["C_MAT_CODE"].ToString() + "' ";
                                int    countNC = dal.Get_NC_Batch_Count(sql_NC);
                                if (countNC > 1)
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("该批次信息不在同一个仓库,不能判定!");
                                }
                                else if (countNC == 0)
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("该批次信息还没有入库!");
                                }

                                string interface_nc = dal_interface.SendXml_GP(strUrl, strBatchNo, C_MASTER_ID, dt_Group.Rows[i]["C_MAT_CODE"].ToString(), dt_Group.Rows[i]["N_WGT"].ToString(), dt_Group.Rows[i]["QUA"].ToString(), dt_Group.Rows[i]["C_ZYX1"].ToString(), dt_Group.Rows[i]["C_ZYX2"].ToString(), mod_wgd, C_GP_BEFORE_ID);

                                if (interface_nc != "1")
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return(interface_nc);
                                }

                                #endregion
                            }
                        }
                        else
                        {
                            DataTable dt_Group = dalTrcRollProduct.Get_List_ByGroup(strBatchNo).Tables[0];

                            for (int i = 0; i < dt_Group.Rows.Count; i++)
                            {
                                #region 更新线材实绩表

                                DataTable dt = DalTqcRollCommute.GetList_max_MasterID_Trans().Tables[0];

                                if (string.IsNullOrEmpty(dt.Rows[0]["C_MASTER_ID"].ToString()))
                                {
                                    C_MASTER_ID = "sj" + time.ToString("yyMMdd00001");
                                }
                                else
                                {
                                    C_MASTER_ID = "sj" + (Convert.ToInt64(dt.Rows[0]["C_MASTER_ID"].ToString()) + 1).ToString();
                                }

                                if (string.IsNullOrEmpty(dt.Rows[0]["C_GP_BEFORE_ID"].ToString()))
                                {
                                    C_GP_BEFORE_ID = "pq" + time.ToString("yyMMdd00001");
                                }
                                else
                                {
                                    C_GP_BEFORE_ID = "pq" + (Convert.ToInt64(dt.Rows[0]["C_GP_BEFORE_ID"].ToString()) + 1).ToString();
                                }

                                if (!dalTrcRollProduct.Update_Trans(C_MASTER_ID, C_GP_BEFORE_ID, dt_Group.Rows[i]["C_STD_CODE"].ToString(), dt_Group.Rows[i]["C_MAT_CODE"].ToString(), dt_Group.Rows[i]["C_ZYX1"].ToString(), dt_Group.Rows[i]["C_ZYX2"].ToString(), strBatchNo))
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("操作失败!");
                                }

                                #endregion

                                #region   条码

                                DataTable dt_Details = dalTrcRollProduct.Get_Details(strBatchNo, dt_Group.Rows[i]["C_STD_CODE"].ToString(), dt_Group.Rows[i]["C_MAT_CODE"].ToString(), dt_Group.Rows[i]["C_ZYX1"].ToString(), dt_Group.Rows[i]["C_ZYX2"].ToString()).Tables[0];


                                if (dt_Details.Rows.Count > 0)
                                {
                                    string sql = "";

                                    for (int kk = 0; kk < dt_Details.Rows.Count; kk++)
                                    {
                                        sql = "insert into ReZJB_GPD(Barcode,WGDH,CK,HW,PCH,WLH,WLMC,SX,PH,GG,BB,GH,ZL,BZ,RQ,RKType,RKRY,WeightRQ,ProduceData,PCInfo,vfree0,vfree3,GPTYPE,ZJBstatus,CAPPK,insertts,vfree1,vfree2) values('" + dt_Details.Rows[kk]["C_BARCODE"] + "','" + dt_Details.Rows[kk]["C_TRC_ROLL_MAIN_ID"] + "','" + dt_Details.Rows[kk]["C_LINEWH_CODE"] + "','" + dt_Details.Rows[kk]["C_LINEWH_LOC_CODE"] + "','" + dt_Details.Rows[kk]["C_BATCH_NO"] + "','" + dt_Details.Rows[kk]["C_MAT_CODE"] + "','" + dt_Details.Rows[kk]["C_MAT_DESC"] + "','" + dt_Details.Rows[kk]["C_JUDGE_LEV_ZH"] + "','" + dt_Details.Rows[kk]["C_STL_GRD"] + "','" + dt_Details.Rows[kk]["C_SPEC"] + "mm','" + dt_Details.Rows[kk]["C_GROUP"] + "','" + dt_Details.Rows[kk]["C_TICK_NO"] + "','" + dt_Details.Rows[kk]["N_WGT"] + "','" + dt_Details.Rows[kk]["C_STD_CODE"] + "','" + dt_Details.Rows[kk]["D_RKRQ"] + "','" + dt_Details.Rows[kk]["C_MOVE_DESC"] + "','" + dt_Details.Rows[kk]["C_RKRY"] + "','" + dt_Details.Rows[kk]["D_WEIGHT_DT"] + "','" + dt_Details.Rows[kk]["D_PRODUCE_DATE"] + "','" + dt_Details.Rows[kk]["C_PCINFO"] + "','" + dt_Details.Rows[kk]["C_STOVE"] + "','" + dt_Details.Rows[kk]["C_BZYQ"] + "','','0','" + dt_Details.Rows[kk]["C_ID"] + "','" + time + "','" + dt_Details.Rows[kk]["C_ZYX1"].ToString() + "','" + dt_Details.Rows[kk]["C_ZYX2"].ToString() + "')";

                                        if (TransactionHelper_SQL.ExecuteSql(sql) == 0)
                                        {
                                            TransactionHelper.RollBack();
                                            TransactionHelper_SQL.RollBack();
                                            return("信息传到条码时出错!");
                                        }
                                    }
                                }
                                else
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("信息传到条码时出错!");
                                }

                                #endregion

                                #region   NC

                                string sql_NC = "select count(distinct t.STORCODE) from XGERP50.V_ONHAND_XC t where t.批次号='" + strBatchNo + "' AND T.INVTYPE='" + dt_Group.Rows[i]["C_STL_GRD"].ToString() + "' AND T.INVCODE='" + dt_Group.Rows[i]["C_MAT_CODE"].ToString() + "'  ";

                                int countNC = dal.Get_NC_Batch_Count(sql_NC);
                                if (countNC > 1)
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("该批次信息不在同一个仓库,不能判定!");
                                }
                                else if (countNC == 0)
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return("该批次信息还没有入库!");
                                }

                                string interface_nc = dal_interface_No_Wgd.SendXml_GP(strUrl, strBatchNo, C_MASTER_ID, dt_Group.Rows[i]["C_MAT_CODE"].ToString(), dt_Group.Rows[i]["N_WGT"].ToString(), dt_Group.Rows[i]["QUA"].ToString(), dt_Group.Rows[i]["C_ZYX1"].ToString(), dt_Group.Rows[i]["C_ZYX2"].ToString(), C_GP_BEFORE_ID);

                                if (interface_nc != "1")
                                {
                                    TransactionHelper.RollBack();
                                    TransactionHelper_SQL.RollBack();
                                    return(interface_nc);
                                }

                                #endregion
                            }
                        }
                    }
                    else
                    {
                        TransactionHelper.RollBack();
                        TransactionHelper_SQL.RollBack();
                        return("信息有误!");
                    }
                }

                TransactionHelper.Commit();
                TransactionHelper_SQL.Commit();
            }
            catch (Exception ex)
            {
                TransactionHelper.RollBack();
                TransactionHelper_SQL.RollBack();
                return(ex.Message);
            }

            return(result);
        }