wtt
2025-04-02 9cfdb479a1083fc9615779edcff50472319dd387
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -52,7 +52,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "完工单无编辑权限!";
                        objJsonResult.Message = "[0000-1-065]完工单无编辑权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -63,7 +63,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "出站单无编辑权限!";
                        objJsonResult.Message = "[0000-1-065]出站单无编辑权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -152,7 +152,7 @@
                double HLossQty = list[0].HLossQty;//遗失数量
                double HBackWorkByMaterQty = list[0].HBackWorkByMaterQty;//遗失数量
                int HMouldID = list[0].HMouldID;//模具id
                double HMachineWorkTimes = list[0].HMachineWorkTimes;//设备工时
                LogService.Write($"1.字段赋值,用时" + sw.Elapsed );
                //单据完整性判断
@@ -160,7 +160,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "流转卡没有选择!请扫描条形码或输入条形码后回车";
                    objJsonResult.Message = "[3791-2-005]流转卡没有选择!请扫描条形码或输入条形码后回车";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -168,7 +168,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "流水号没有选择!请输入流水号后回车";
                    objJsonResult.Message = "[0000-2-032]流水号没有选择!请输入流水号后回车";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -176,7 +176,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "流水号没有选择!";
                    objJsonResult.Message = "[0000-2-032]流水号没有选择!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -184,7 +184,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "流转卡号没有选择!";
                    objJsonResult.Message = "[0000-2-032]流转卡号没有选择!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -192,7 +192,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "产品没有选择!";
                    objJsonResult.Message = "[0000-2-007]产品没有选择!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -209,7 +209,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "当前工序没有选择!";
                    objJsonResult.Message = "[0000-2-011]当前工序没有选择!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -239,7 +239,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "生产资源没有选择!";
                            objJsonResult.Message = "[0000-2-006]生产资源没有选择!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -255,7 +255,7 @@
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "操作员没有选择!";
                                objJsonResult.Message = "[0000-2-030]操作员没有选择!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
@@ -268,7 +268,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "操作员没有选择!";
                            objJsonResult.Message = "[0000-2-030]操作员没有选择!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -280,7 +280,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "合格数量加报废数量加不良数量不能为0!";
                            objJsonResult.Message = "[3791-2-006]合格数量加报废数量加不良数量不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -293,7 +293,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "当前工单不是开工状态不能汇报!";
                            objJsonResult.Message = "[3791-2-007]当前工单不是开工状态不能汇报!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -303,7 +303,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "合格数量加报废数量不能为0!";
                            objJsonResult.Message = "[3791-2-008]合格数量加报废数量不能为0!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -373,7 +373,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存前判断失败!";
                    objJsonResult.Message = "[0000-2-012]保存前判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -381,7 +381,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.Message = "[0000-1-051]保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -398,7 +398,7 @@
                        oCN.RollBack();
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号重复!";
                        objJsonResult.Message = "[0000-2-013]单据号重复!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -413,7 +413,7 @@
                    ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" +
                    ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" +
                    ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID,HWasterQty_Work,HWasterQty_Mater,HBackWorkQty,HShiftsID" +
                    ",HToCheckQty,HLossQty,HBackWorkByMaterQty,HMouldID" +
                    ",HToCheckQty,HLossQty,HBackWorkByMaterQty,HMouldID,HMachineWorkTimes " +
                    ") " +
                    " values('" + BillType + "','" + (OperationType == "5" ? "SUB" : HBillSubType)  + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",'"+ HDate + "','" + HMaker + "',getdate(),'" + HMouldNum + "'" +
                    "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL +
@@ -424,7 +424,7 @@
                    "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) +
                    "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID +
                    "," + HmaterOutqty + "," + HProcPriceRate + "," + HTemporaryAreaID + "," + HWasterQty_Work + "," + HWasterQty_Mater + "," + HBackWorkQty +
                    "," + HShiftsID + "," + HToCheckQty + "," + HLossQty + ","+ HBackWorkByMaterQty + "," + HMouldID + ") ");
                    "," + HShiftsID + "," + HToCheckQty + "," + HLossQty + ","+ HBackWorkByMaterQty + "," + HMouldID + ",'" + HMachineWorkTimes + "') ");
                    LogService.Write($"4.新增结束,用时" + sw.Elapsed);
                    LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增工序出站单据:" + HBillNo);
@@ -451,6 +451,7 @@
                    ",HSourceID5=" + HSourceID5 +
                    ",HPayProcID=" + HPayProcID +
                    ",HGroupID=" + HGroupID +
                    ",HShiftsID=" + HShiftsID +
                    ",HWorkTimes=" + HWorkTimes +
                    ",HSaveBillFlag=0 " +
                    ",HBadCount=" + HBadCount +
@@ -468,9 +469,9 @@
                    ",HWasterQty_Work=" + HWasterQty_Work +
                    ",HWasterQty_Mater=" + HWasterQty_Mater +
                    ",HBackWorkQty=" + HBackWorkQty +
                    ",HShiftsID=" + HShiftsID +
                    ",HBackWorkByMaterQty=" + HBackWorkByMaterQty +
                    ",HMouldID=" + HMouldID +
                    ",HMachineWorkTimes=" + HMachineWorkTimes +
                    " where HInterID=" + HInterID);
                    LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",修改工序出站单据:" + HBillNo);
@@ -481,7 +482,7 @@
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "操作类型无效!";
                    objJsonResult.Message = "[0000-2-014]操作类型无效!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -494,7 +495,7 @@
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "判断数量失败!";
                    objJsonResult.Message = "[0000-2-015]判断数量失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -504,7 +505,7 @@
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "判断数量失败!";
                    objJsonResult.Message = "[0000-2-015]判断数量失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -514,7 +515,7 @@
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "数量控制," + ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.Message = "[0000-2-015]数量控制," + ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -589,7 +590,7 @@
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存后控制判断失败!";
                    objJsonResult.Message = "[0000-2-016]保存后控制判断失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
@@ -599,7 +600,7 @@
                    oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.Message = "[0000-1-051]保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -650,7 +651,7 @@
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "新增单据成功!";
                objJsonResult.Message = "[0000-1-050]新增单据成功!";
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
            }
@@ -660,7 +661,7 @@
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.Message = "[0000-1-051]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -1658,7 +1659,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "完工单无查询权限!";
                        objJsonResult.Message = "[0000-1-068]完工单无查询权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -1669,7 +1670,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "出站单无查询权限!";
                        objJsonResult.Message = "[0000-1-068]出站单无查询权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -1690,7 +1691,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "没有查询到相关用户信息!";
                            objJsonResult.Message = "[0000-1-069]没有查询到相关用户信息!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -1724,7 +1725,7 @@
                //{
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.Message = "[0000-1-037]Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
@@ -1742,7 +1743,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -1764,7 +1765,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "完工单无查询权限!";
                        objJsonResult.Message = "[0000-1-068]完工单无查询权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -1776,7 +1777,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "出站单无查询权限!";
                        objJsonResult.Message = "[0000-1-068]出站单无查询权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -1797,7 +1798,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "没有查询到相关用户信息!";
                            objJsonResult.Message = "[0000-1-069]没有查询到相关用户信息!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -1829,7 +1830,7 @@
                objJsonResult.code = "1";
                objJsonResult.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString());
                objJsonResult.Message = "Sucess!";
                objJsonResult.Message = "[0000-1-037]Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
@@ -1838,7 +1839,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -1870,7 +1871,10 @@
                    case "Emp":
                        sql = "select * from h_v_Sc_StationOutBillSubQuery_Emp where 1 = 1 and HInterID=" + sWhere;
                        break;
                    case "Sup":
                        sql = "select * from h_v_Sc_StationOutBillSubQuery_Sup where 1 = 1 and HInterID=" + sWhere;
                        break;
                }
                ds = oCN.RunProcReturn(sql, TableName);
@@ -1886,7 +1890,7 @@
              
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "Sucess!";
                objJsonResult.Message = "[0000-1-037]Sucess!";
                objJsonResult.list = columnNameList;
                objJsonResult.data = ds.Tables[0];
                return objJsonResult;
@@ -1895,7 +1899,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -1949,7 +1953,7 @@
            string HRemark = HttpContext.Current.Request.Params["HRemark"];  //备注
            string HUserName = HttpContext.Current.Request.Params["HUserName"];  //创建人
            HttpPostedFile files = HttpContext.Current.Request.Files["file"];
            string path = HttpContext.Current.Server.MapPath("~/../Files/" + HBillNo);
            string path = HttpContext.Current.Server.MapPath("~/../Files/Cj_StationOutBill/" + HBillNo);
            //string path = @"D:\\Files\\"+ HBillNo;
            dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName);
            if (dyResult != null && dyResult.result == 1)
@@ -2005,7 +2009,7 @@
                {
                    File.Delete(fileurl);      //删除指定文件
                    files.SaveAs(fileurl);
                    string StrPath = "/files/"+ HBillNo+"/"+ filename;
                    string StrPath = "/files/Cj_StationOutBill/" + HBillNo+"/"+ filename;
                    if (File.Exists(fileurl)) 
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -2028,7 +2032,7 @@
                {
                    Directory.CreateDirectory(fileSavePath); //添加文件夹
                    files.SaveAs(fileurl);
                    string StrPath = "/files/" + HBillNo + "/" + filename;
                    string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename;
                    if (File.Exists(fileurl))
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -2069,7 +2073,7 @@
            string HRemark = HttpContext.Current.Request.Params["HRemark"];  //备注
            string HUserName = HttpContext.Current.Request.Params["HUserName"];  //创建人
            HttpPostedFile files = HttpContext.Current.Request.Files["file"];
            string path = HttpContext.Current.Server.MapPath("~/../Files/" + HBillNo);
            string path = HttpContext.Current.Server.MapPath("~/../Files/Cj_StationOutBill/" + HBillNo);
            //string path = @"D:\\Files\\"+ HBillNo;
            dynamic dyResult = UpLoadFile1(files, path, HBillNo, HRemark, HUserName);
            if (dyResult != null && dyResult.result == 1)
@@ -2125,7 +2129,7 @@
                {
                    File.Delete(fileurl);      //删除指定文件
                    files.SaveAs(fileurl);
                    string StrPath = "/files/" + HBillNo + "/" + filename;
                    string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename;
                    if (File.Exists(fileurl))
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -2148,7 +2152,7 @@
                {
                    Directory.CreateDirectory(fileSavePath); //添加文件夹
                    files.SaveAs(fileurl);
                    string StrPath = "/files/" + HBillNo + "/" + filename;
                    string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename;
                    if (File.Exists(fileurl))
                    {
                        //这里可以执行一些其它的操作,比如更新数据库
@@ -2198,7 +2202,7 @@
        [HttpGet]
        public object Filelist(string HBillNo)
        {
            var url = fileip + "/files/" + HBillNo+"/";
            var url = fileip + "/files/Cj_StationOutBill/" + HBillNo+"/";
            //@"C:\\files\\"
            try
            {
@@ -2233,7 +2237,7 @@
            {
                oCN.RunProc("delete from MES_AccessoriesList where HItemID =" + HItemID);
                string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/" + HSourceBillNo), HFileName);
                string fileurl = Path.Combine(HttpContext.Current.Server.MapPath("~/../Files/Cj_StationOutBill/" + HSourceBillNo), HFileName);
                File.Delete(fileurl);      //删除指定文件
                objJsonResult.code = "1";
                objJsonResult.count = 1;
@@ -2268,7 +2272,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "完工单无权限!";
                        objJsonResult.Message = "[0000-1-058]完工单无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2279,7 +2283,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "出站单无权限!";
                        objJsonResult.Message = "[0000-1-058]出站单无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2297,7 +2301,7 @@
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "只能删除本人的单据!";
                                objJsonResult.Message = "[0000-1-011]只能删除本人的单据!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
@@ -2313,7 +2317,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "判断关联失败!";
                        objJsonResult.Message = "[0000-2-018]判断关联失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2321,7 +2325,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                        objJsonResult.Message = "[0000-1-007]" + Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2329,7 +2333,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已经审核,不能删除!";
                        objJsonResult.Message = "[0000-1-013]单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2340,7 +2344,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "系统参数控制,已有下道工序,不能删除!";
                        objJsonResult.Message = "[3791-1-002]系统参数控制,已有下道工序,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2350,7 +2354,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除出站汇报单发生异常,没有任何返回记录!";
                        objJsonResult.Message = "[3791-1-005]删除出站汇报单发生异常,没有任何返回记录!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2360,7 +2364,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = ds.Tables[0].Rows[0]["HRemarkBack"].ToString();
                            objJsonResult.Message = "[0000-1-007]" + ds.Tables[0].Rows[0]["HRemarkBack"].ToString();
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -2374,7 +2378,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系";
                        objJsonResult.Message = "[0000-1-006]删除失败!原因:删除前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2383,7 +2387,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.Message = "[0000-1-007]删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2393,7 +2397,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "[0000-1-007]" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2405,7 +2409,7 @@
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "删除成功!";
                        objJsonResult.Message = "[0000-1-008]删除成功!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2414,7 +2418,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到!";
                    objJsonResult.Message = "[0000-1-005]单据未找到!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -2424,7 +2428,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "异常!" + e.ToString();
                objJsonResult.Message = "[0000-1-007]异常!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -2446,7 +2450,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "完工单无权限!";
                        objJsonResult.Message = "[3791-1-001]完工单无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2458,7 +2462,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "出站单无权限!";
                        objJsonResult.Message = "[3791-1-001]出站单无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2476,7 +2480,7 @@
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "只能删除本人的单据!";
                                objJsonResult.Message = "[0000-1-011]只能删除本人的单据!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
@@ -2492,7 +2496,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "判断关联失败!";
                        objJsonResult.Message = "[0000-2-018]判断关联失败!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2500,7 +2504,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                        objJsonResult.Message = "[0000-1-007]" + Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2508,7 +2512,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已经审核,不能删除!";
                        objJsonResult.Message = "[0000-1-013]单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2519,7 +2523,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "系统参数控制,已有下道工序,不能删除!";
                        objJsonResult.Message = "[3791-1-002]系统参数控制,已有下道工序,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2542,7 +2546,7 @@
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "删除成功!";
                    objJsonResult.Message = "[0000-1-008]删除成功!";
                    objJsonResult.data = null;
                    return objJsonResult;
@@ -2551,7 +2555,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到!";
                    objJsonResult.Message = "[0000-1-005]单据未找到!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -2561,7 +2565,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "异常!" + e.ToString();
                objJsonResult.Message = "[0000-1-007]异常!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -2646,7 +2650,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "判断关联失败!";
                    objJsonResult.Message = "[0000-2-018]判断关联失败!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -2654,7 +2658,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                    objJsonResult.Message = "[0000-1-038]" + Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -2662,7 +2666,7 @@
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "Sucess!";
                    objJsonResult.Message = "[0000-1-037]Sucess!";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
@@ -2671,7 +2675,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -2692,7 +2696,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "完工单审核失败!无权限!";
                        objJsonResult.Message = "[0000-1-060]完工单审核失败!无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2703,7 +2707,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "出站单审核失败!无权限!";
                        objJsonResult.Message = "[0000-1-060]出站单审核失败!无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2720,7 +2724,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "第"+(i+1)+"行:单据ID为0,不能审核!";
                        objJsonResult.Message = "[0000-1-009]第" + (i+1)+"行:单据ID为0,不能审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2731,7 +2735,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "第" + (i + 1) + "行:单据已审核!不能再次审核";
                            objJsonResult.Message = "[0000-1-023]第" + (i + 1) + "行:单据已审核!不能再次审核";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -2741,7 +2745,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "第" + (i + 1) + "行:单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "[0000-1-005]第" + (i + 1) + "行:单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2750,14 +2754,14 @@
                int j = 0;
                for (int i = 0; i < HInterIDs.Length; i++)
                {
                    //审核前控制
                    //审核前控制================================================================================
                    string sql = "exec h_p_Sc_StationOutBill_BeforeCheckCtrl " + HInterIDs[i] + ",'" + HBillNo[i] + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_BeforeCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.Message = "[0000-1-024]审核失败!原因:审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2766,11 +2770,11 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.Message = "[0000-1-025]审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //================================================================================
                    //审核
                    if (Cj_StationOutBillCheckBill(long.Parse(HInterIDs[i]), HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
@@ -2781,7 +2785,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "成功:" + j + "行,第" + (i + 1) + "行:审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "[0000-1-025]成功:" + j + "行,第" + (i + 1) + "行:审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2789,7 +2793,7 @@
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "全部执行成功!";
                objJsonResult.Message = "[0000-1-029]全部执行成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -2797,7 +2801,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败!" + e.ToString();
                objJsonResult.Message = "[0000-1-025]审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -2846,7 +2850,7 @@
                    LogService.Write("出站单据审核更改流转卡数量,流转卡:" + HProcExchBillNo + ",出站单号:" + HBillNo + ",原流转卡数量:" + HProcExchQty + ",新流转卡数量:" + HQty);
                }
                //审核后控制
                //审核后控制================================================================================
                string sql = "exec h_p_Sc_StationOutBill_AfterCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_AfterCheckCtrl");
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
@@ -2861,7 +2865,7 @@
                    oCN.RollBack();
                    return false;
                }
                //================================================================================
                sReturn = sReturn + " 审核功能!";
                oCN.Commit();
@@ -2890,7 +2894,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "完工单反审核失败!无权限!";
                        objJsonResult.Message = "[0000-1-061]完工单反审核失败!无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2902,7 +2906,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "出站单反审核失败!无权限!";
                        objJsonResult.Message = "[0000-1-061]出站单反审核失败!无权限!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2923,7 +2927,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "第" + (i + 1) + "行:单据ID为0,不能反审核!";
                        objJsonResult.Message = "[0000-1-009]第" + (i + 1) + "行:单据ID为0,不能反审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2935,7 +2939,7 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "第" + (i + 1) + "行:单据未审核!不需要反审核!";
                            objJsonResult.Message = "[0000-1-018]第" + (i + 1) + "行:单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
@@ -2947,7 +2951,7 @@
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "第" + (i + 1) + "行:审核人和反审核人不一致!";
                                objJsonResult.Message = "[0000-1-062]第" + (i + 1) + "行:审核人和反审核人不一致!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
@@ -2959,7 +2963,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "第" + (i + 1) + "行:单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "[0000-1-005]第" + (i + 1) + "行:单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -2968,14 +2972,14 @@
                int j = 0;
                for (int i = 0; i < HInterIDs.Length; i++)
                {
                    //反审核前控制
                    //反审核前控制=============================================================
                    string sql = "exec h_p_Sc_StationOutBill_BeforeUnCheckCtrl " + HInterIDs[i] + ",'" + HBillNo[i] + "','" + CurUserName + "'";
                    ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_BeforeUnCheckCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.Message = "[0000-1-027]反审核失败!原因:反审核前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
@@ -2984,11 +2988,11 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.Message = "[0000-1-028]反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //================================================================================
                    //反审核
                    if (Cj_StationOutBillAbandonCheckBill(long.Parse(HInterIDs[i]),HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
                    {
@@ -2998,7 +3002,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "成功:" + j + "行,第" + (i + 1) + "行:反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "[0000-1-028]成功:" + j + "行,第" + (i + 1) + "行:反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -3006,7 +3010,7 @@
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "全部执行成功!";
                objJsonResult.Message = "[0000-1-019]全部执行成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -3014,7 +3018,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "反审核失败!" + e.ToString();
                objJsonResult.Message = "[0000-1-028]反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -3082,7 +3086,7 @@
                return false; ;
            }
        }
        #endregion
        #region 工序出站关闭/反关闭功能
        [Route("Cj_StationOutBill/CloseCj_StationOutBill")]
@@ -3098,7 +3102,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "完工单无权限关闭!";
                        objJsonResult.Message = "[0000-1-063]完工单无权限关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -3109,7 +3113,7 @@
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "出站单无权限关闭!";
                        objJsonResult.Message = "[0000-1-063]出站单无权限关闭!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -3120,7 +3124,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID为空!";
                    objJsonResult.Message = "[0000-1-009]HInterID为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -3142,17 +3146,41 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已关闭!不需要再关闭!";
                            objJsonResult.Message = "[0000-1-033]单据已关闭!不需要再关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //关闭单据
                    if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    //关闭前控制=========================================
                    string sql1 = "exec h_p_Sc_StationOutBill_BeforeCloseCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationOutBill_BeforeCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "关闭失败!原因:关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //关闭单据
                    if (!BillOld.CloseBill(Int64.Parse(HInterID), HBillNo, "h_p_Sc_StationOutBill_AfterCloseCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "[0000-1-034]关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -3169,17 +3197,41 @@
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已反关闭!不需要再反关闭!";
                            objJsonResult.Message = "[0000-1-035]单据已反关闭!不需要再反关闭!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    //反关闭单据
                    if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo))
                    var HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    //反关闭前控制=========================================
                    string sql1 = "exec h_p_Sc_StationOutBill_BeforeUnCloseCtrl " + HInterID + ",'" + HBillNo + "','" + user + "'";
                    ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationOutBill_BeforeUnCloseCtrl");
                    if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.Message = "反关闭失败!原因:反关闭前判断失败,请与网络管理人员联系";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反关闭失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //==================================================================================
                    //反关闭单据
                    if (!BillOld.CancelClose(Int64.Parse(HInterID), HBillNo, "h_p_Sc_StationOutBill_AfterUnCloseCtrl", user, ref ClsPub.sExeReturnInfo))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "[0000-1-036]反关闭失败!原因:" + ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
@@ -3189,7 +3241,7 @@
                objJsonResult.code = "0";
                objJsonResult.count = 1;
                objJsonResult.Message = "执行成功!";
                objJsonResult.Message = "[0000-1-064]执行成功!";
                objJsonResult.data = null;
                return objJsonResult; ;
@@ -3198,7 +3250,7 @@
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "执行失败!" + e.ToString();
                objJsonResult.Message = "[0000-1-034]执行失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -3207,7 +3259,7 @@
        //是否被关联
        #region //是否被关联
        public bool Cj_StationInBillisUse(Int64 lngBillKey, ref string sReturn)
        {
            try
@@ -3832,7 +3884,7 @@
                {
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "";
                    objJsonResult.Message = "[0000-1-037]";
                    objJsonResult.data = ds.Tables[0];
                    return objJsonResult;
                }
@@ -3840,7 +3892,7 @@
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "";
                    objJsonResult.Message = "[0000-1-010]";
                    return objJsonResult;
                }
@@ -3851,7 +3903,7 @@
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "没有返回任何记录!" + e.ToString();
                objJsonResult.Message = "[0000-1-010]没有返回任何记录!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
@@ -3975,5 +4027,213 @@
            }
        }
        #endregion
        #region 编辑页面根据id获取工序出站汇报单信息
        [Route("Cj_StationOutBill/SetBillTime")]
        [HttpGet]
        public object SetBillTime(int HInterID,DateTime dateTime,string user)
        {
            try
            {
                //判断是否有编辑权限
                if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-1-065]出站单无编辑权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                string sql = "select * from Sc_StationOutBillMain  with(nolock) where HInterID=" + HInterID;
                ds = oCN.RunProcReturn(sql, "Sc_StationOutBillMain");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[3791-1-003]修改失败没找到相关出站汇报单";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //修改前时间修改后时间判断有无工资计算
                string HGroupID = ds.Tables[0].Rows[0]["HGroupID"].ToString();
                string HOldDate = ds.Tables[0].Rows[0]["HDate"].ToString();
                string sql1 = "select * from Pay_SingleBalBillMain where HGroupID =" +HGroupID + " and HDate ='" + HOldDate + "'";
                string sql2 = "select * from Pay_GroupBalBillMain where HGroupID =" + HGroupID + " and HDate ='" + HOldDate + "'";
                string sql3 = "select * from Pay_SingleBalBillMain where HGroupID =" + HGroupID + " and HDate ='" + dateTime + "'";
                string sql4 = "select * from Pay_GroupBalBillMain where HGroupID =" + HGroupID + " and HDate ='" + dateTime + "'";
                ds = oCN.RunProcReturn(sql1, "Sc_StationOutBillMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[3791-1-004]修改失败该时间班组已计算工资:" + HOldDate;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn(sql2, "Sc_StationOutBillMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[3791-1-004]修改失败该时间班组已计算工资:" + HOldDate;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn(sql3, "Sc_StationOutBillMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[3791-1-004]修改失败该时间班组已计算工资:" + dateTime;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn(sql4, "Sc_StationOutBillMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[3791-1-004]修改失败该时间班组已计算工资:" + dateTime;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                //修改时间
                sql = "update Sc_StationOutBillMain set HDate = '" + dateTime + "' where HInterID = " + HInterID;
                oCN.RunProcReturn(sql, "Sc_StationOutBillMain");
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "[0000-1-067]Sucess!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "[0000-1-066]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region 出站单列表-下推PPM数据录入保存,删除
        [Route("Cj_StationOutBill/PPMSupAddBill")]
        [HttpPost]
        public object PPMSupAddBill([FromBody] JObject sSubStr)
        {
            var _value = sSubStr["sSubStr"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            try
            {
                //反序列化
                string msg2 = sArray[0].ToString(); //表体
                string refSav = sArray[1].ToString();//操作类型
                string user = sArray[2].ToString(); //用户
                msg2 = msg2.Substring(1, msg2.Length - 2);
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");
                msg2 = "[" + msg2 + "]";
                //判断是否有编辑权限
                if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "无编辑权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                List<Sc_StationOutBillSub_Sup> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Sc_StationOutBillSub_Sup>>(msg2);
                oCN.BeginTran();
                for (int i = 0; i < list.Count; i++)
                {
                    int HInterID = list[i].HInterID;
                    int HEntryID = i+1;
                    int HSupID = list[i].HSupID;
                    double HWasterQty_Mater = list[i].HWasterQty_Mater;
                    double HBackWorkQty = list[i].HBackWorkQty;
                    oCN.RunProc("Insert Into Sc_StationOutBillSub_Sup " +
                     "(HInterID, HEntryID, HSupID, HWasterQty_Mater, HBackWorkQty) " +
                     "values ('" + HInterID + "', '" + HEntryID + "', '" + HSupID + "', '" + HWasterQty_Mater + "', '" + HBackWorkQty + "')");
                }
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "新增单据成功!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        [Route("Cj_StationOutBill/PPMSupDelete")]
        [HttpGet]
        public object PPMSupDelete(int HInterID,string user)
        {
            try
            {
                //判断是否有查询权限
                if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, user))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-1-058]无删除权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from Sc_StationOutBillSub_Sup WITH(NOLOCK) where HInterID = " + HInterID, "Sc_StationOutBillSub_Sup");
                if (ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "[0000-1-045]查无数据!";
                    objJsonResult.data = null;
                }
                oCN.BeginTran();
                string sql = "";
                sql = "delete from Sc_StationOutBillSub_Sup where HInterID = " + HInterID;
                oCN.RunProc(sql);
                oCN.Commit();
                objJsonResult.code = "1";
                objJsonResult.count = 1;
                objJsonResult.Message = "[0000-1-037]Sucess!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            catch (Exception e)
            {
                oCN.RollBack();
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "[0000-1-038]Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
    }
}