chenhaozhe
2 天以前 d7f3369550e06d123fc959f8da3549535c2a5afe
WebAPI/Controllers/JHGL/Gy_RoutingBillController.cs
@@ -26,6 +26,7 @@
        public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View();
        DAL.ClsGy_WorkCenter_View oCenHlp = new DAL.ClsGy_WorkCenter_View();
        DAL.ClsGy_Warehouse_View oCenWare = new DAL.ClsGy_Warehouse_View();
        DAL.ClsGy_Source_View oSourceHlp = new DAL.ClsGy_Source_View();
        Gy_RoutingBill_temporary omdelMian = new Gy_RoutingBill_temporary();
        public string BillType = "3301";
        Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
@@ -1413,6 +1414,598 @@
        }
        #endregion
        #region 工艺路线_孙表 文件上传
        [Route("Gy_RoutingBill/Gy_RoutingBillimport_WorkQty")]
        [HttpPost]
        public object Gy_RoutingBillimport_WorkQty()
        {
            try
            {
                var WorkBookName = HttpContext.Current.Request["WorkBookName"];
                DBUtility.ClsPub.HOrgID = long.Parse(HttpContext.Current.Request["HOrgID"]);
                Int64 HOrgID = long.Parse(HttpContext.Current.Request["HOrgID"]);
                //获取文件名称
                var file = HttpContext.Current.Request.Files[0];
                //获取文件物理路径
                string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName);
                //保存文件
                file.SaveAs(ExcelPath);
                NpoiHelper np = new NpoiHelper();
                DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 2, WorkBookName);
                //删除文件
                File.Delete(ExcelPath);
                //创建临时表
                DataTable tb2 = new DataTable("dt2");
                DataTable tb3 = new DataTable("dt3");
                //添加列名
                for (int i = 0; i < ExcelDs.Tables[0].Columns.Count; i++)
                {
                    tb2.Columns.Add(ExcelDs.Tables[0].Rows[0][i].ToString());
                }
                //添加数据
                for (int i = 1; i < ExcelDs.Tables[0].Rows.Count; i++)
                {
                    DataRow row = tb2.NewRow();
                    for (int j = 0; j < ExcelDs.Tables[0].Columns.Count; j++)
                    {
                        row[j] = ExcelDs.Tables[0].Rows[i][j].ToString();
                    }
                    tb2.Rows.Add(row);
                }
                var error = "";
                //查询工艺路线没有的列
                if (!tb2.Columns.Contains("产品代码"))
                    error += "没有找到【产品代码】的标题,";
                if (!tb2.Columns.Contains("工序序号"))
                    error += "没有找到【工序序号】的标题,";
                if (!tb2.Columns.Contains("工序"))
                    error += "没有找到【工序】的标题,";
                if (!tb2.Columns.Contains("加工数量"))
                    error += "没有找到【加工数量】的标题,";
                //if (!tb2.Columns.Contains("工作中心"))
                //    error += "没有找到【工作中心】的标题,";
                //if (!tb2.Columns.Contains("本道开工余量"))
                //    error += "没有找到【本道开工余量】的标题,";
                //if (!tb2.Columns.Contains("本道固定开工天数"))
                //    error += "没有找到【本道固定开工天数】的标题,";
                //if (!tb2.Columns.Contains("班产定额"))
                //    error += "没有找到【班产定额】的标题,";
                //if (!tb2.Columns.Contains("工序工价"))
                //    error += "没有找到【工序工价】的标题,";
                //if (!tb2.Columns.Contains("工艺参数"))
                //    error += "没有找到【工艺参数】的标题,";
                //if (!tb2.Columns.Contains("图纸编号"))
                //    error += "没有找到【图纸编号】的标题,";
                //if (!tb2.Columns.Contains("本工序确认记录"))
                //    error += "没有找到【本工序确认记录】的标题,";
                //if (!tb2.Columns.Contains("图号版本"))
                //    error += "没有找到【图号版本】的标题,";
                //if (!tb2.Columns.Contains("总装图号"))
                //    error += "没有找到【总装图号】的标题,";
                //if (!tb2.Columns.Contains("材质"))
                //    error += "没有找到【材质】的标题,";
                //if (!tb2.Columns.Contains("成品编号"))
                //    error += "没有找到【成品编号】的标题,";
                //if (!tb2.Columns.Contains("版本"))
                //    error += "没有找到【版本】的标题,";
                //if (!tb2.Columns.Contains("模具编号"))
                //    error += "没有找到【模具编号】的标题,";
                //if (!tb2.Columns.Contains("程序号"))
                //    error += "没有找到【程序号】的标题,";
                //if (!tb2.Columns.Contains("良率"))
                //    error += "没有找到【良率】的标题";
                //if (!tb2.Columns.Contains("不良品仓"))
                //    error += "没有找到【不良品仓】的标题";
                //if (!tb2.Columns.Contains("报废品仓"))
                //    error += "没有找到【报废品仓】的标题";
                //if (!tb2.Columns.Contains("良品仓"))
                //    error += "没有找到【良品仓】的标题";
                if (!tb2.Columns.Contains("生产资源代码"))
                    error += "没有找到【生产资源代码】的标题,";
                //if (!tb2.Columns.Contains("生产资源"))
                //    error += "没有找到【生产资源】的标题,";
                if (error.Length > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = $"Excel模板存在错误,{error}\r\n";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //数据校验
                objJsonResult = (json)Checkdata_WorkQty(tb2);
                if (objJsonResult.code == "0")
                {
                    return objJsonResult;
                }
                //删除临时表数据
                oCN.RunProc("delete from diyipi_WorkQty");
                //临时表添加数据
                for (int i = 0; i < tb2.Rows.Count; i++)
                {
                    string sql_temp = "insert into diyipi_WorkQty(工艺路线代码,工艺路线名称, 产品代码,产品名称,工序序号,工序代码,工序,工作中心,加工数量" +
                                //", 良率, 工序工价, 不合格单价, 报废单价, 本道固定开工天数, 本道开工余量, 上道等待天数" +
                                //", 上道循环周期, 自动转移, 外协标记, 供应商代码, 供应商, 工艺参数, 图纸编号" +
                                //", 本工序确认记录, 备注, 图号版本, 总装图号, 材质, 成品编号, 版本" +
                                //", 模具编号, 程序号, 班产定额, 时间单位,不良品仓,报废品仓,良品仓" +
                                ",生产资源代码,HOrgID" +
                                ") " +
                                " values(" +
                                "'" + tb2.Rows[i]["工艺路线代码"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["工艺路线名称"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["产品代码"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["产品名称"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["工序序号"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["工序代码"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["工序"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["工作中心"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["加工数量"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["良率"].ToString() + "'" +
                                //",'" + (tb2.Rows[i]["工序工价"].ToString() == "" ? "0" : tb2.Rows[i]["工序工价"].ToString()) + "'" +
                                //",'" + tb2.Rows[i]["不合格单价"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["报废单价"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["本道固定开工天数"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["本道开工余量"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["上道等待天数"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["上道循环周期"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["自动转移"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["外协标记"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["供应商代码"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["供应商"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["工艺参数"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["图纸编号"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["本工序确认记录"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["备注"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["图号版本"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["总装图号"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["材质"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["成品编号"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["版本"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["模具编号"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["程序号"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["班产定额"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["时间单位"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["不良品仓"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["报废品仓"].ToString() + "'" +
                                //",'" + tb2.Rows[i]["良品仓"].ToString() + "'" +
                                ",'" + tb2.Rows[i]["生产资源代码"].ToString() + "'" +
                                "," + HOrgID + "" +
                                ")";
                    oCN.RunProc(sql_temp);
                }
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = error;
                objJsonResult.data = tb2;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        //数据检验
        private object Checkdata_WorkQty(DataTable dt)
        {
            bool b = false;
            string sErrMsg = "";
            string sMsg = "";
            for (int i = 0; i <= dt.Rows.Count - 1; i++)
            {
                string sHNumber = "";
                string sHNamePoc = "";
                string sHNumberCen = "";
                Single sWorkQty = 0;
                Single sHPassRate = 0;
                string sHNumberSource = "";
                sHNumber = DBUtility.ClsPub.isStrNull(dt.Rows[i]["产品代码"].ToString());
                sHNamePoc = DBUtility.ClsPub.isStrNull(dt.Rows[i]["工序序号"].ToString());
                sHNamePoc = DBUtility.ClsPub.isStrNull(dt.Rows[i]["工序"].ToString());
                sWorkQty = DBUtility.ClsPub.isSingle(dt.Rows[i]["加工数量"].ToString());
                //sHNumberCen = DBUtility.ClsPub.isStrNull(dt.Rows[i]["工作中心"].ToString());
                //sHPassRate = DBUtility.ClsPub.isSingle(dt.Rows[i]["良率"].ToString());
                sHNumberSource = DBUtility.ClsPub.isStrNull(dt.Rows[i]["生产资源代码"].ToString());
                if (sHNumber != "")
                {
                    //记录检验数据的所在行
                    int index = i + 1;
                    //得到物料内码
                    if (!oMaterHlp.GetInfoByNumber(sHNumber))
                    {
                        sMsg = "[" + sHNumber + "]物料不存在";
                        if (sErrMsg.Contains(sMsg) == false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNumber + "]物料不存在\r\n";
                        }
                        b = true;
                    }
                    //得到工序内码
                    if (!oProcHlp.GetInfoByName(sHNamePoc))
                    {
                        sMsg = "[" + sHNamePoc + "]工序不存在";
                        if (sErrMsg.Contains(sMsg) == false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNamePoc + "]工序不存在\r\n";
                        }
                        b = true;
                    }
                    //加工数量不能小于等于零
                    if (sWorkQty < 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "第" + index + "行加工数量不能小于等于零!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    ////良率不能小于等于零
                    //if (sHPassRate <= 0)
                    //{
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "第" + index + "行良率不能小于等于零!";
                    //    objJsonResult.data = null;
                    //    return objJsonResult;
                    //}
                    ////审核代码是否合理
                    //if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                    //{
                    //    objJsonResult.code = "0";
                    //    objJsonResult.count = 0;
                    //    objJsonResult.Message = "物料代码中不能出现连续‘.’并且首位末位不能为‘.’!";
                    //    objJsonResult.data = null;
                    //    return objJsonResult;
                    //}
                    ////得到工作中心内码
                    //if (!oCenHlp.GetInfoByName(sHNumberCen))
                    //{
                    //    sMsg = "[" + sHNumberCen + "]工作中心不存在";
                    //    if (sErrMsg.Contains(sMsg) == false)
                    //    {
                    //        sErrMsg = sErrMsg + "[" + sHNumberCen + "]工作中心不存在\r\n";
                    //    }
                    //    b = true;
                    //}
                    //拆分【生产资源代码】,并逐个验证
                    if (sHNumberSource != "")
                    {
                        char[] delimiter = new char[] { ',' };
                        string[] sHNumberSourceList = sHNumberSource.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
                        for (int t = 0; t < sHNumberSourceList.Length; t++)
                        {
                            if (!oSourceHlp.GetInfoByNumber(sHNumberSourceList[t]))
                            {
                                sMsg = "[" + sHNumberSourceList[t] + "]生产资源不存在";
                                if (sErrMsg.Contains(sMsg) == false)
                                {
                                    sErrMsg = sErrMsg + "[" + sHNumberSourceList[t] + "]生产资源不存在\r\n";
                                }
                                b = true;
                            }
                        }
                    }
                }
            }
            if (b == true)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = sErrMsg;
                objJsonResult.data = null;
                return objJsonResult;
            }
            else
            {
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = sErrMsg;
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 工艺路线_孙表 导入(保存)
        [Route("Gy_RoutingBill/Gy_RoutingBill_WorkQty_btnSave")]
        [HttpPost]
        public object Gy_RoutingBill_WorkQty_btnSave([FromBody] JObject sMainSub)
        {
            var _value = sMainSub["sMainSub"].ToString();
            string msg1 = _value.ToString();
            oCN.BeginTran();
            //保存主表
            objJsonResult = RoutAddBillMain_WorkQty(msg1);
            if (objJsonResult.code == "0")
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = objJsonResult.Message;
                objJsonResult.data = null;
                return objJsonResult;
            }
            oCN.Commit();
            objJsonResult.code = "1";
            objJsonResult.count = 1;
            objJsonResult.Message = objJsonResult.Message;
            objJsonResult.data = null;
            return objJsonResult;
        }
        public json RoutAddBillMain_WorkQty(string msg1)
        {
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string user = sArray[2].ToString();
            try
            {
                if (!DBUtility.ClsPub.Security_Log("Gy_RoutingBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无保存权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //表头字段
                omdelMian = Newtonsoft.Json.JsonConvert.DeserializeObject<Gy_RoutingBill_temporary>(msg2);
                string finalErrMsg = "";
                //获取导入表中的最新数据
                DataSet dsMain = oCN.RunProcReturn("select  distinct 产品代码 from  diyipi_WorkQty", "diyipi_WorkQty");
                if (dsMain.Tables[0].Rows.Count > 0)
                {
                    for(int i=0;i< dsMain.Tables[0].Rows.Count; i++)
                    {
                        string HMaterNumber = DBUtility.ClsPub.isStrNull(dsMain.Tables[0].Rows[0]["产品代码"]);
                        if (!oMaterHlp.GetInfoByNumber(HMaterNumber))
                        {
                            string sMsg = "物料【" + HMaterNumber + "】不存在!";
                            if (finalErrMsg.Contains(sMsg) == false)
                            {
                                finalErrMsg = finalErrMsg + "物料【" + HMaterNumber + "】不存在!\r\n";
                            }
                            continue;
                        }
                        //获取该物料导入的数据中是否存在多个工艺路线,如果存在,则报错
                        string HBillNo = "";
                        Int64 HInterID = 0;
                        DataSet dsHBillNo = oCN.RunProcReturn("select  distinct 工艺路线代码,工艺路线名称 from  diyipi_WorkQty where 产品代码 = '" + HMaterNumber + "'", "diyipi_WorkQty");
                        if (dsHBillNo.Tables[0].Rows.Count > 1)
                        {
                            string sMsg = "物料【" + HMaterNumber + "】存在多组【工艺路线代码,工艺路线名称】!";
                            if (finalErrMsg.Contains(sMsg) == false)
                            {
                                finalErrMsg = finalErrMsg + "物料【" + HMaterNumber + "】存在多组【工艺路线代码,工艺路线名称】!\r\n";
                            }
                            continue;
                        }
                        else                                                     //物料对应工艺路线唯一,获取工艺路线主内码与工艺路线代码
                        {
                            //生成唯一的工艺路线代码
                            HBillNo = DBUtility.ClsPub.isStrNull(dsHBillNo.Tables[0].Rows[0]["工艺路线代码"]);
                            if (HBillNo == "")
                            {
                                DataSet dataSet = oCN.RunProcReturn($"select HBillNo  from  Gy_RoutingBillMain where HBillNo='1' ", "Gy_RoutingBillMain");
                                while (1 == 1)
                                {
                                    if (HBillNo != "")
                                    {
                                        if (dataSet.Tables[0].Rows.Count == 0)
                                        {
                                            break;
                                        }
                                    }
                                    HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true);
                                    dataSet = oCN.RunProcReturn($"select HBillNo  from  Gy_RoutingBillMain where HBillNo='{HBillNo}' ", "Gy_RoutingBillMain");
                                }
                            }
                            //生成唯一的工艺路线内码
                            if (HInterID == 0)
                            {
                                while (1 == 1)
                                {
                                    HInterID = DBUtility.ClsPub.CreateBillID_Prod(BillType, ref DBUtility.ClsPub.sExeReturnInfo);//获得一个新的id
                                    DataSet dataSet = oCN.RunProcReturn("select * from Gy_RoutingBillMain where HInterID=" + HInterID, "Gy_RoutingBillMain");
                                    if (dataSet.Tables[0].Rows.Count == 0)
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                        //拼接主表插入语句
                        string sqlMain = "insert into Gy_RoutingBillMain" +
                            "(HInterID,HYear,HPeriod,HBillType,HBillNo,HName,HDate,HMaker,HMakeDate,HRemark,HOrgID" +
                            ",HMaterID,HMaterNumber,HUnitID,HUnitNumber,HStandard,HRoutingGroupID) " +
                            "values(" +
                            "" + HInterID + "" +
                            "," + DateTime.Now.Year + "" +
                            "," + DateTime.Now.Month + "" +
                            ",'" + BillType + "'" +
                            ",'" + HBillNo + "'" +
                            ", ''" +
                            "," + "convert(varchar(100),getdate(),23)" + "" +
                            ",'" + user + "'" +
                            ", getdate()" +
                            ",'" + "批量导入(包含孙表)" + "'" +
                            "," + omdelMian.HOrgID +
                            "," + oMaterHlp.omodel.HItemID + "" +
                            ",'" + oMaterHlp.omodel.HNumber + "'" +
                            "," + oMaterHlp.omodel.HUnitID + "" +
                            ",'" + oMaterHlp.omodel.HUnitNumber + "'" +
                            "," + 1 + "" +
                            "," + 0 + "" +
                            ")";
                        //获取该物料的工艺路线信息子表数据
                        DataSet dsSub = oCN.RunProcReturn("select * from diyipi_WorkQty where 产品代码 = '" + HMaterNumber + "' order by 工序序号", "diyipi_WorkQty");
                        for(int j = 0; j < dsSub.Tables[0].Rows.Count; j++)
                        {
                            string HProcNumber = DBUtility.ClsPub.isStrNull(dsSub.Tables[0].Rows[j]["工序代码"]);
                            //得到工序内码
                            if (!oProcHlp.GetInfoByNumber(HProcNumber))
                            {
                                string sMsg = "工序【" + HProcNumber + "】不存在!";
                                if (finalErrMsg.Contains(sMsg) == false)
                                {
                                    finalErrMsg = finalErrMsg + "工序【" + HProcNumber + "】不存在!\r\n";
                                }
                                continue;
                            }
                            else
                            {
                                string sqlSub = "insert into Gy_RoutingBillSub" +
                                    "(HInterID,HEntryID,HProcNo,HProcID,HCenterID,HWorkQty,HSortProcFlag,HRemark,HTimeUnit,HReadyTime,HQueueTime,HMoveTime) " +
                                    "values(" +
                                    "" + HInterID + "" +
                                    "," + (j + 1) + "" +
                                    "," + DBUtility.ClsPub.isLong(dsSub.Tables[0].Rows[j]["工序序号"]) +
                                    "," + oProcHlp.omodel.HItemID + "" +
                                    "," + 0 + "" +
                                    "," + DBUtility.ClsPub.isDoule(dsSub.Tables[0].Rows[j]["加工数量"]) +
                                    ",1" +
                                    ",'批量导入(包括孙表)'" +
                                    ", 0" +
                                    ", 0" +
                                    ", 0" +
                                    ", 0" +
                                    ")";
                                char[] delimiter = new char[] { ',' };
                                string HSourceNumberList = DBUtility.ClsPub.isStrNull(dsSub.Tables[0].Rows[j]["生产资源代码"]);
                                string[] sHNumberSourceList = HSourceNumberList.Split(delimiter, StringSplitOptions.RemoveEmptyEntries);
                                for(int t = 0; t < sHNumberSourceList.Length; t++)
                                {
                                    //得到生产资源内码
                                    if (!oSourceHlp.GetInfoByNumber(sHNumberSourceList[t]))
                                    {
                                        string sMsg = "生产资源【" + HProcNumber + "】不存在!";
                                        if (finalErrMsg.Contains(sMsg) == false)
                                        {
                                            finalErrMsg = finalErrMsg + "生产资源【" + HProcNumber + "】不存在!\r\n";
                                        }
                                        continue;
                                    }
                                    else
                                    {
                                        string sqlSub_WorkQty = "insert into Gy_RoutingBillSub_WorkQty" +
                                            "(HInterID,HEntryID,HEntrySubID,HRemark,HSourceID) " +
                                            "values(" +
                                            "" + HInterID + "" +
                                            "," + (j+1) + "" +
                                            "," + (t+1) + "" +
                                            ", '批量导入(包括孙表)'" +
                                            "," + oSourceHlp.omodel.HItemID + "" +
                                            ")";
                                        oCN.RunProc(sqlSub_WorkQty);
                                    }
                                }
                                oCN.RunProc(sqlSub);
                            }
                        }
                        oCN.RunProc(sqlMain);
                        oCN.RunProc("update Gy_RoutingBillMain set HStandard = 0 where HMaterID = " + oMaterHlp.omodel.HItemID + " and HInterID <>" + HInterID);
                    }
                }
                if (finalErrMsg.Length > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = finalErrMsg;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                oCN.RunProc("delete from diyipi_WorkQty");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "导入完成,共" + dsMain.Tables[0].Rows.Count + "个工艺路线";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region  工艺路线 审核、反审核
        /// <summary>
        ///