|  |  | 
 |  |  |                 string OperationType = sArray[2].ToString();//类型 | 
 |  |  |                 string HComputerName = SystemInformation.ComputerName; //设备名称 | 
 |  |  |  | 
 |  |  |                 //判断是否有编辑权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user)) | 
 |  |  |                 if (OperationType == "5") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无编辑权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                     //判断是否有编辑权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Edit", 1, false, user)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "完工单无编辑权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else { | 
 |  |  |                     //判断是否有编辑权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "出站单无编辑权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 Stopwatch sw = new Stopwatch(); | 
 |  |  |                 sw.Start();//开始计时 | 
 |  |  | 
 |  |  |                 double HmaterOutqty = list[0].HmaterOutqty;//白坯发布 | 
 |  |  |                 double HProcPriceRate = list[0].HProcPriceRate;//工价系数 | 
 |  |  |                 int HTemporaryAreaID = list[0].HTemporaryAreaID;//暂放区 | 
 |  |  |                 double HWasterQty_Work = list[0].HWasterQty_Work;//工废数量 | 
 |  |  |                 double HWasterQty_Mater = list[0].HWasterQty_Mater;//料废数量 | 
 |  |  |                 double HBackWorkQty = list[0].HBackWorkQty;//返工数量 | 
 |  |  |                 Int64 HShiftsID = list[0].HShiftsID;//生产班次 | 
 |  |  |  | 
 |  |  |                 LogService.Write($"1.字段赋值,用时" + sw.Elapsed ); | 
 |  |  |  | 
 |  |  | 
 |  |  |                 var num = 0; | 
 |  |  |                 //LogService.Write($"3.事务开始,用时" + sw.Elapsed); | 
 |  |  |  | 
 |  |  |                 //保存前控制========================================= | 
 |  |  |                 string HBillNote = ""; | 
 |  |  |                 ds = oCN.RunProcReturn("Exec  h_p_Sc_StationOutBill_BeforeSaveCtrl  " + HInterID.ToString() + ", '" + HBillNo + "','" + HBillNote + "',1 ", " h_p_Sc_StationOutBill_BeforeSaveCtrl "); | 
 |  |  |                 if (ds == null) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "保存前判断失败!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 if (DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) != "0") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]); | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //========================================================= | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 //若MAINDI重复则重新获取 | 
 |  |  |                 oCN.BeginTran(); | 
 |  |  |                 if ("Add".Equals(eventType)) | 
 |  |  | 
 |  |  |                     ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + | 
 |  |  |                     ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + | 
 |  |  |                     ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" + | 
 |  |  |                         ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID" + | 
 |  |  |                     ",HmaterOutqty,HProcPriceRate,HTemporaryAreaID,HWasterQty_Work,HWasterQty_Mater,HBackWorkQty,HShiftsID" + | 
 |  |  |                     ") " + | 
 |  |  |                     " values('" + BillType + "','" + (OperationType == "5" ? "SUB" : HBillSubType)  + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + | 
 |  |  |                     "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + | 
 |  |  | 
 |  |  |                     "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" + | 
 |  |  |                     "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + | 
 |  |  |                     "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID + | 
 |  |  |                   ","+ HmaterOutqty + "," + HProcPriceRate + ","+ HTemporaryAreaID + ") "); | 
 |  |  |                     ","+ HmaterOutqty + "," + HProcPriceRate + ","+ HTemporaryAreaID + "," + HWasterQty_Work + "," + HWasterQty_Mater + "," + HBackWorkQty + | 
 |  |  |                     "," + HShiftsID + ") "); | 
 |  |  |  | 
 |  |  |                     LogService.Write($"4.新增结束,用时" + sw.Elapsed); | 
 |  |  |                     LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",新增工序出站单据:" + HBillNo); | 
 |  |  | 
 |  |  |                     ",HSourceNameList='" + HSourceNameList + "'" + | 
 |  |  |                     ",HWasterQty=" + HWasterQty + | 
 |  |  |                     ",HLastSubProc=" + Convert.ToString(HLastSubProc ? 1 : 0) + | 
 |  |  |                     ",HWasterQty_Work=" + HWasterQty_Work + | 
 |  |  |                     ",HWasterQty_Mater=" + HWasterQty_Mater + | 
 |  |  |                     ",HBackWorkQty=" + HBackWorkQty + | 
 |  |  |                     ",HShiftsID=" + HShiftsID + | 
 |  |  |                     " where HInterID=" + HInterID); | 
 |  |  |  | 
 |  |  |                     LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",修改工序出站单据:" + HBillNo); | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 //主表 | 
 |  |  |  | 
 |  |  |                 //LogService.Write($"5.系统控制查询判断,用时" + sw.Elapsed); | 
 |  |  |                 LogService.Write($"5.系统控制查询判断,用时" + sw.Elapsed); | 
 |  |  |                 ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl"); | 
 |  |  |                 if (ds == null) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //LogService.Write($"5.1,用时" + sw.Elapsed); | 
 |  |  |                 LogService.Write($"5.1,用时" + sw.Elapsed); | 
 |  |  |                 if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     oCN.RollBack(); | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //LogService.Write($"5.2,用时" + sw.Elapsed); | 
 |  |  |                 LogService.Write($"5.2,用时" + sw.Elapsed); | 
 |  |  |                 if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2") | 
 |  |  |                 { | 
 |  |  |                     oCN.RollBack(); | 
 |  |  | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //LogService.Write($"6.判断结束,用时" + sw.Elapsed); | 
 |  |  |                 LogService.Write($"6.判断结束,用时" + sw.Elapsed); | 
 |  |  |                 oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + ","+ num + ""); | 
 |  |  |                 //LogService.Write($"6.1,用时" + sw.Elapsed); | 
 |  |  |                 LogService.Write($"6.1,用时" + sw.Elapsed); | 
 |  |  |                 oCN.RunProc("exec h_p_Mes_ProcessExchangeChangeStatus  " + HInterID + " "); | 
 |  |  |                 //LogService.Write($"6.2,用时" + sw.Elapsed); | 
 |  |  |                 LogService.Write($"6.2,用时" + sw.Elapsed); | 
 |  |  |                 oCN.RunProc("exec h_p_Mes_StationOutBillBackBarCode  " + HInterID + " "); | 
 |  |  |                 //LogService.Write($"7.存储过程结束,用时" + sw.Elapsed); | 
 |  |  |                 LogService.Write($"7.存储过程结束,用时" + sw.Elapsed); | 
 |  |  |                 //判断是否是 末道工序  | 
 |  |  |                 ds1 = oCN.RunProcReturn(" select HLastProc,HFstProc from Sc_ProcessExchangeBillMain a  " + | 
 |  |  |                                     " inner join Sc_ProcessExchangeBillSub b on a.HInterID=b.HInterID  " + | 
 |  |  |                                     " Where a.HInterID=" + HProcExchInterID + " and b.HEntryID=" + HProcExchEntryID + " ", "Sc_ProcessExchangeBillMain"); | 
 |  |  |                 LogService.Write($"7.1.查询,用时" + sw.Elapsed); | 
 |  |  |                 //判断是否是新增 | 
 |  |  |                 if ("Add".Equals(eventType)) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 LogService.Write($"7.2.查询,用时" + sw.Elapsed); | 
 |  |  |  | 
 |  |  |                 //=========================保存后控制   | 
 |  |  |                 DataSet ds2 = oCN.RunProcReturn("Exec h_p_Sc_StationOutBill_AfterSaveCtrl " + HInterID.ToString() + ", '" + HBillNo + "',1 ", "h_p_Sc_StationOutBill_AfterSaveCtrl"); | 
 |  |  |                 if (ds2 == null) | 
 |  |  |                 { | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "保存后控制判断失败!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 if (DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBack"]) != "0") | 
 |  |  |                 { | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "保存失败2!" + DBUtility.ClsPub.isStrNull(ds2.Tables[0].Rows[0]["HBackRemark"]); | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 //============================ | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                 //LogService.Write($"10.事务结束,用时" + sw.Elapsed); | 
 |  |  |                 LogService.Write($"10.事务结束,用时" + sw.Elapsed); | 
 |  |  |                 oCN.Commit(); | 
 |  |  |                 string sReturn = ""; | 
 |  |  |                 if (oSystemParameter.ShowBill(ref sReturn) == true) | 
 |  |  | 
 |  |  |                     long HMaterID = listSub[i].HMaterID;//产品ID | 
 |  |  |                     long HProcID = listSub[i].HProcID;//当前工序ID | 
 |  |  |                     double HICMOQty = listSub[i].HICMOQty;//任务单数量 | 
 |  |  |                     double HPlanQty = list[0].HPlanQty;//移交PNL数 | 
 |  |  |                     double HPlanQty = listSub[i].HPlanQty;//移交PNL数 | 
 |  |  |                     DateTime HStationOutTime = list[0].HStationOutTime;//汇报时间 | 
 |  |  |                     long HSourceID = listSub[i].HSourceID;//生产资源ID | 
 |  |  |                     long HPayProcID = list[0].HPayProcID;//核算工序ID | 
 |  |  | 
 |  |  |                     string HProcNo = listSub[i].HProcNo;//流水号 | 
 |  |  |                     string HOrderProcNO = list[0].HOrderProcNO;//订单跟踪号 | 
 |  |  |                     string HSourceNameList = list[0].HSourceNameList;//设备清单 | 
 |  |  |                     long HMainSourceInterID = list[0].HInterID;//递入type得到的单据ID | 
 |  |  |                     string HMainSourceBillNo = list[0].HBillNo;//递入type得到的单据号 | 
 |  |  |                     long HMainSourceInterID = listSub[0].HMainSourceInterID;//递入type得到的单据ID | 
 |  |  |                     long HMainSourceEntryID = listSub[0].HMainSourceEntryID;//递入type得到的单据子ID | 
 |  |  |                     string HMainSourceBillNo = listSub[0].HMainSourceBillNo;//递入type得到的单据号 | 
 |  |  |                     string HMainSourceBillType = "3790"; | 
 |  |  |                     bool HLastSubProc = list[0].HLastSubProc;//转下工序 | 
 |  |  |                     bool HLastSubProc = listSub[0].HLastSubProc;//转下工序 | 
 |  |  |                     long HEmpID2 = list[0].HEmpID2;//操作员2ID | 
 |  |  |                     long HEmpID3 = list[0].HEmpID3;//操作员3ID | 
 |  |  |                     long HEmpID4 = list[0].HEmpID4;//操作员4ID | 
 |  |  | 
 |  |  |                         ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HSourceID2,HSourceID3,HSourceID4,HSourceID5" + | 
 |  |  |                         ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" + | 
 |  |  |                         ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" + | 
 |  |  |                         ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" + | 
 |  |  |                         ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID,HMainSourceEntryID" + | 
 |  |  |                         ") " + | 
 |  |  |                         " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" + | 
 |  |  |                         "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL + | 
 |  |  | 
 |  |  |                         "," + HGroupID + "," + HDeptID + "," + HEmpID + ",'" + HBarCode + "','" + HAddr + "','" + HBarCodeMaker + "',getdate()" + "," + HSourceID2 + "," + HSourceID3 + "," + HSourceID4 + "," + HSourceID5 + | 
 |  |  |                         "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" + | 
 |  |  |                         "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) + | 
 |  |  |                         "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID + | 
 |  |  |                         "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID + "," + HMainSourceEntryID + | 
 |  |  |                         ") "); | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  | 
 |  |  |         //递入物料信息 返回未完全汇报的流转卡 | 
 |  |  |         [Route("LEMS/Sc_StationOutBill_Mul_RYQ")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Sc_StationOutBill_Mul_RYQ(String HMaterName, Int64 HOrgID) | 
 |  |  |         public object Sc_StationOutBill_Mul_RYQ(String HMaterName,string HProcNumber, Int64 HOrgID) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); | 
 |  |  |                 DataSet ds = oCN.RunProcReturn("exec h_p_CJGXPLHB_Query '" + HMaterName + "'," + HOrgID + "", "h_p_CJGXPLHB_Query"); | 
 |  |  |                 DataSet ds = oCN.RunProcReturn("exec h_p_CJGXPLHB_Query '" + HMaterName + "'," + HOrgID + ",'"+ HProcNumber + "'", "h_p_CJGXPLHB_Query"); | 
 |  |  |                 | 
 |  |  |                 if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         #region 返回工序出站汇报单列表 | 
 |  |  |         [Route("Cj_StationOutBill/get_Display")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object get_Display(string sWhere,string user) | 
 |  |  |         public object get_Display(string sWhere,string user,string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |                 //判断是否有查询权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) | 
 |  |  |                 if (HBillSubType == "SUB") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无查询权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                     //判断是否有查询权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Query", 1, false, user)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "完工单无查询权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else { | 
 |  |  |                     //判断是否有查询权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "出站单无查询权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 //获取系统参数 | 
 |  |  |                 string Ret = ""; | 
 |  |  | 
 |  |  |                 //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 工序出站汇报单 子表查询 | 
 |  |  |         [Route("Cj_StationOutBill/get_SubDisplay")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object get_SubDisplay(string sWhere, string TableName) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 List<object> columnNameList = new List<object>(); | 
 |  |  |  | 
 |  |  |                 string sql = ""; | 
 |  |  |  | 
 |  |  |                 switch (TableName) | 
 |  |  |                 { | 
 |  |  |                     case "TechParam": | 
 |  |  |                         sql = "select * from h_v_Sc_StationOutBillSubQuery_TechParam where 1 = 1 and HInterID=" + sWhere; | 
 |  |  |                         break; | 
 |  |  |                     case "Note": | 
 |  |  |                         sql = "select * from h_v_Sc_StationOutBillSubQuery_Note where 1 = 1 and HInterID=" + sWhere; | 
 |  |  |                         break; | 
 |  |  |                     case "SN": | 
 |  |  |                         sql = "select * from h_v_Sc_StationOutBillSubQuery_SN where 1 = 1 and HInterID=" + sWhere; | 
 |  |  |                         break; | 
 |  |  |                     case "Emp": | 
 |  |  |                         sql = "select * from h_v_Sc_StationOutBillSubQuery_Emp where 1 = 1 and HInterID=" + sWhere; | 
 |  |  |                         break; | 
 |  |  |                    | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn(sql, TableName); | 
 |  |  |  | 
 |  |  |                 //添加列名 | 
 |  |  |                 foreach (DataColumn col in ds.Tables[0].Columns) | 
 |  |  |                 { | 
 |  |  |                     Type dataType = col.DataType; | 
 |  |  |                     string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; | 
 |  |  |                     columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.list = columnNameList; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  | 
 |  |  |         #region 根据id删除出站单 | 
 |  |  |         [Route("Cj_StationOutBill/del_StationOutBill")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object del_StationOutBill(long HInterID, string HDeleteMan) | 
 |  |  |         public object del_StationOutBill(long HInterID, string HDeleteMan,string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string HComputerName = SystemInformation.ComputerName; //设备名称 | 
 |  |  |                 //编辑权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan)) | 
 |  |  |                 if (HBillSubType == "SUB") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                     //编辑权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Drop", 1, false, HDeleteMan)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "完工单无权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else { | 
 |  |  |                     //编辑权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "出站单无权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 | 
 |  |  |                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill(); | 
 |  |  |                 if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //删除前判断有没有生成金蝶单据(生产汇报单,生产入库单) | 
 |  |  |                     ds = oCn.RunProcReturn($"exec h_p_Cj_StationOutBill_BeforeDelCtrl {HInterID}", "h_p_Cj_StationOutBill_BeforeDelCtrl"); | 
 |  |  |                     if (ds == null || ds.Tables[0].Rows.Count <= 0) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "删除出站汇报单发生异常,没有任何返回记录!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  |                         if (ds.Tables[0].Rows[0]["HBackCount"].ToString() == "1") | 
 |  |  |                         { | 
 |  |  |                             objJsonResult.code = "0"; | 
 |  |  |                             objJsonResult.count = 0; | 
 |  |  |                             objJsonResult.Message = ds.Tables[0].Rows[0]["HRemarkBack"].ToString(); | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     //删除前控制=========================================       | 
 |  |  |                     string HBillNo = oBill.omodel.HBillNo; | 
 |  |  |                     string sql1 = "exec h_p_Sc_StationOutBill_BeforeDelCtrl " + HInterID + ",'" + HBillNo + "','" + HDeleteMan + "'"; | 
 |  |  |                     ds = oCN.RunProcReturn(sql1, "h_p_Sc_StationOutBill_BeforeDelCtrl"); | 
 |  |  |                     if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //==================================================================================       | 
 |  |  |  | 
 |  |  |                     if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, HBillNo, "h_p_Sc_StationOutBill_AfterDelCtrl", HDeleteMan, ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "单据未找到!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "异常!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 根据id删除出站单 子件条码 | 
 |  |  |         [Route("Cj_StationOutBill/del_StationOutBill_SN")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object del_StationOutBill_SN(long HInterID,string HBardcode, string HDeleteMan, string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string HComputerName = SystemInformation.ComputerName; //设备名称 | 
 |  |  |                 if (HBillSubType == "SUB") | 
 |  |  |                 { | 
 |  |  |                     //编辑权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Drop", 1, false, HDeleteMan)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "完工单无权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //编辑权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "出站单无权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill(); | 
 |  |  |                 if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                 { | 
 |  |  |                     string sReturn = ""; | 
 |  |  |                     if (oSystemParameter.ShowBill(ref sReturn)) | 
 |  |  |                     { | 
 |  |  |                         if (oSystemParameter.omodel.MES_StationOutBill_DeleteCtl == "Y") | 
 |  |  |                         { | 
 |  |  |                             if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin")) | 
 |  |  |                             { | 
 |  |  |                                 objJsonResult.code = "0"; | 
 |  |  |                                 objJsonResult.count = 0; | 
 |  |  |                                 objJsonResult.Message = "只能删除本人的单据!"; | 
 |  |  |                                 objJsonResult.data = null; | 
 |  |  |                                 return objJsonResult; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |                     SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); | 
 |  |  |                     DataSet ds; | 
 |  |  |                     //判断是否存在 相同单据号 的领料单 判断生产订单是否已结案,要求计划手工反结案     | 
 |  |  |                     ds = oCn.RunProcReturn("exec h_p_MES_StationOutBill_DelCtrl  '" + oBill.omodel.HBillNo + "'", "h_p_MES_StationOutBill_DelCtrl"); | 
 |  |  |                     if (ds == null) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "判断关联失败!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     if (ds.Tables[0].Rows.Count > 0 && Pub_Class.ClsPub.isInt(ds.Tables[0].Rows[0][0]) == 2) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = Pub_Class.ClsPub.isStrNull(ds.Tables[0].Rows[0][1]); | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     if (oBill.omodel.HChecker != "") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "单据已经审核,不能删除!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     ds = oCn.RunProcReturn($"exec h_p_DelOutInBill {HInterID},'MES_StationOutBill_DeleteRelationCtl'", "h_p_DelOutInBill"); | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows[0][0].ToString() == "0") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "系统参数控制,已有下道工序,不能删除!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     oCn.BeginTran(); | 
 |  |  |  | 
 |  |  |                     oCn.RunProc("delete from Sc_StationOutBillSub_SN where HInterID="+ HInterID+ " and HBarCode='"+ HBardcode + "'"); | 
 |  |  |  | 
 |  |  |                     oCn.Commit(); | 
 |  |  |  | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = "删除成功!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  | 
 |  |  |         #region 审核 | 
 |  |  |         [Route("Cj_StationOutBill/set_CheckBill")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object set_CheckBill(string HInterID, string CurUserName) | 
 |  |  |         public object set_CheckBill(string HInterID, string CurUserName,string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string ModRightNameCheck = "Cj_StationOutBill_Check"; | 
 |  |  |                 ////审核权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) | 
 |  |  |                 if (HBillSubType == "SUB") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "审核失败!无权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                     ////审核权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Check", 1, false, CurUserName)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "完工单审核失败!无权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 var HBillNo = HInterID.Split(','); | 
 |  |  |                 else | 
 |  |  |                 {   ////审核权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Check", 1, false, CurUserName)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "出站单审核失败!无权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                | 
 |  |  |              | 
 |  |  |                 var HInterIDs = HInterID.Split(','); | 
 |  |  |                 string[] HBillNo = new string[HInterIDs.Length]; | 
 |  |  |                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill(); | 
 |  |  |  | 
 |  |  |                 for (int i = 0; i < HBillNo.Length; i++) | 
 |  |  |                 for (int i = 0; i < HInterIDs.Length; i++) | 
 |  |  |                 { | 
 |  |  |                     if (HBillNo[i] == "0") | 
 |  |  |                     if (HInterIDs[i] == "0") | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     //查看是否已审核,关闭,作废 | 
 |  |  |                     if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     if (oBill.ShowBill(long.Parse(HInterIDs[i]), ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     { | 
 |  |  |                         if (oBill.omodel.HChecker.Trim() != "") | 
 |  |  |                         { | 
 |  |  | 
 |  |  |                             objJsonResult.data = null; | 
 |  |  |                             return objJsonResult; | 
 |  |  |                         } | 
 |  |  |                         HBillNo[i] = oBill.omodel.HBillNo; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 int j = 0; | 
 |  |  |                 for (int i = 0; i < HBillNo.Length; i++) | 
 |  |  |                 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.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 (Cj_StationOutBillCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     if (Cj_StationOutBillCheckBill(long.Parse(HInterIDs[i]), HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     { | 
 |  |  |                         j += 1; | 
 |  |  |                     } | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //审核 | 
 |  |  |         public bool Cj_StationOutBillCheckBill(Int64 lngBillKey, string CurUserName,bool HLastSubProc, ref string sReturn) | 
 |  |  |         public bool Cj_StationOutBillCheckBill(Int64 lngBillKey, string HBillNo, string CurUserName,bool HLastSubProc, ref string sReturn) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  | 
 |  |  |                 else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "是") | 
 |  |  |                 { | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //审核后控制 | 
 |  |  |                 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) | 
 |  |  |                 { | 
 |  |  |                     sReturn = "审核过程中出错,请与网络管理人员联系"; | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") | 
 |  |  |                 { | 
 |  |  |                     sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 sReturn = sReturn + " 审核功能!"; | 
 |  |  |                 oCN.Commit(); | 
 |  |  |                 return true; | 
 |  |  | 
 |  |  |         #region 反审核 | 
 |  |  |         [Route("Cj_StationOutBill/set_AbandonCheck")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object set_AbandonCheck(string HInterID, string CurUserName) | 
 |  |  |         public object set_AbandonCheck(string HInterID, string CurUserName,string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 string ModRightNameCheck = "Cj_StationOutBill_Check"; | 
 |  |  |                 ////审核权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName)) | 
 |  |  |                 if (HBillSubType == "SUB") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "反审核失败!无权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                     ////审核权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Check", 1, false, CurUserName)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "完工单反审核失败!无权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     ////审核权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Check", 1, false, CurUserName)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "出站单反审核失败!无权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                | 
 |  |  |  | 
 |  |  |                 var HBillNo = HInterID.Split(','); | 
 |  |  |                 var HInterIDs = HInterID.Split(','); | 
 |  |  |                 string[] HBillNo = new string[HInterIDs.Length]; | 
 |  |  |                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill(); | 
 |  |  |  | 
 |  |  |                 //获取系统参数 | 
 |  |  |                 string Ret = ""; | 
 |  |  |                 oSystemParameter.ShowBill(ref Ret); | 
 |  |  |  | 
 |  |  |                     for (int i = 0; i < HBillNo.Length; i++) | 
 |  |  |                     for (int i = 0; i < HInterIDs.Length; i++) | 
 |  |  |                 { | 
 |  |  |                     if (long.Parse(HBillNo[i]) == 0) | 
 |  |  |                     if (long.Parse(HInterIDs[i]) == 0) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                     //查看是否已审核,关闭,作废 | 
 |  |  |                     if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     if (oBill.ShowBill(long.Parse(HInterIDs[i]), ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     { | 
 |  |  |                         if (oBill.omodel.HChecker.Trim() == "") | 
 |  |  |                         { | 
 |  |  | 
 |  |  |                                 return objJsonResult; | 
 |  |  |                             } | 
 |  |  |                         } | 
 |  |  |  | 
 |  |  |                         HBillNo[i] = oBill.omodel.HBillNo; | 
 |  |  |                     } | 
 |  |  |                     else | 
 |  |  |                     { | 
 |  |  | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 int j = 0; | 
 |  |  |                 for (int i = 0; i < HBillNo.Length; i++) | 
 |  |  |                 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.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 (Cj_StationOutBillAbandonCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     if (Cj_StationOutBillAbandonCheckBill(long.Parse(HInterIDs[i]),HBillNo[i], CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo)) | 
 |  |  |                     { | 
 |  |  |                         j += 1; | 
 |  |  |                     } | 
 |  |  | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //反审核 | 
 |  |  |         public bool Cj_StationOutBillAbandonCheckBill(Int64 lngBillKey, string CurUserName, bool HLastSubProc, ref string sReturn) | 
 |  |  |         public bool Cj_StationOutBillAbandonCheckBill(Int64 lngBillKey,string HBillNo, string CurUserName, bool HLastSubProc, ref string sReturn) | 
 |  |  |         { | 
 |  |  |             if (Cj_StationInBillisUse(lngBillKey, ref sReturn)) | 
 |  |  |             { | 
 |  |  | 
 |  |  |                 else if (Pub_Class.ClsPub.isStrNull(ds1.Tables[0].Rows[0]["HFstProc"]) == "是") | 
 |  |  |                 { | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //反审核后控制 | 
 |  |  |                 string sql = "exec h_p_Sc_StationOutBill_AfterUnCheckCtrl " + lngBillKey + ",'" + HBillNo + "','" + CurUserName + "'"; | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_p_Sc_StationOutBill_AfterUnCheckCtrl"); | 
 |  |  |                 if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     sReturn = "反审核过程中出错,请与网络管理人员联系"; | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |                 if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") | 
 |  |  |                 { | 
 |  |  |                     sReturn = ds.Tables[0].Rows[0]["HRemark"].ToString(); | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     return false; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 sReturn = sReturn + "反审核功能!"; | 
 |  |  |                 oCN.Commit(); | 
 |  |  |                 return true; | 
 |  |  | 
 |  |  |         #region 工序出站关闭/反关闭功能 | 
 |  |  |         [Route("Cj_StationOutBill/CloseCj_StationOutBill")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object CloseCj_StationOutBill(string HInterID, int Type, string user) | 
 |  |  |         public object CloseCj_StationOutBill(string HInterID, int Type, string user,string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //判断是否有删除权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Close", 1, false, user)) | 
 |  |  |                 if (HBillSubType == "SUB") | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无权限关闭!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                     //判断是否有删除权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Close", 1, false, user)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "完工单无权限关闭!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else { | 
 |  |  |                     //判断是否有删除权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Close", 1, false, user)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "出站单无权限关闭!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 | 
 |  |  |  | 
 |  |  |                 if (string.IsNullOrWhiteSpace(HInterID)) | 
 |  |  |                 { | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region  当前工单(扫码汇报) 条码查询 | 
 |  |  |         [Route("Cj_StationOutBill_CurrentWork/SNHBardCodeList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object SNHBardCodeList(string HBarCode, string user, int HOrgID) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ds = oCN.RunProcReturn(@"select HSourceInterID,HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); | 
 |  |  |                | 
 |  |  |                 if (ds.Tables[0].Rows.Count > 0) | 
 |  |  |                 { | 
 |  |  |                     string HSourceInterID = ds.Tables[0].Rows[0]["HSourceInterID"].ToString(); | 
 |  |  |                     string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString(); | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select * from gy_czygl WITH(NOLOCK) where czymc='" + user + "'", "gy_czygl"); | 
 |  |  |                     string HProcID = ds.Tables[0].Rows[0]["HProcID"].ToString(); | 
 |  |  |  | 
 |  |  |                     ds = oCN.RunProcReturn("select  * from h_v_Sc_ProcessExchangeBillList where hmainid=" + HSourceInterID + " and 单据号='" + HSourceBillNo + "' and HProcID=" + HProcID, "h_v_Sc_ProcessExchangeBillList"); | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows.Count == 0) { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "条码:" + HBarCode + ",流转卡:" + HSourceBillNo + ",与当前流转卡,所对应的工序不存在!"; | 
 |  |  |                         objJsonResult.data = ds.Tables[0]; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                     objJsonResult.code = "1"; | 
 |  |  |                     objJsonResult.count = 1; | 
 |  |  |                     objJsonResult.Message = ""; | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "条码查无数据!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region  当前工单(扫码汇报) 出站单查询 | 
 |  |  |         [Route("Cj_StationOutBill_CurrentWork/get_Out_Display")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object get_Out_Display(string sWhere, string user,string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //判断是否有查询权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "出站单无查询权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 string sql1 = "select * from h_v_MES_StationOutBillList_SN where 1 = 1 "; | 
 |  |  |                 string sql = sql1 + sWhere + "  order by 制单日期 desc"; | 
 |  |  |                 ds = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList_SN"); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "Exception!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 当前工单(扫码汇报)  子表保存 | 
 |  |  |         [Route("Cj_StationOutBill_CurrentWork/AddBillSub")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object AddBillSub([FromBody] JObject oMain) | 
 |  |  |         { | 
 |  |  |             var _value = oMain["oMain"].ToString(); | 
 |  |  |             string msg1 = _value.ToString(); | 
 |  |  |             string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //反序列化 | 
 |  |  |                 string msg2 = "[" + sArray[0].ToString() + "]"; | 
 |  |  |                 string user = sArray[1].ToString();//用户名 | 
 |  |  |                 string OperationType = sArray[2].ToString();//类型 | 
 |  |  |  | 
 |  |  |                 if (OperationType == "5") | 
 |  |  |                 { | 
 |  |  |                     //判断是否有编辑权限 | 
 |  |  |                     if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Edit", 1, false, user)) | 
 |  |  |                     { | 
 |  |  |                         objJsonResult.code = "0"; | 
 |  |  |                         objJsonResult.count = 0; | 
 |  |  |                         objJsonResult.Message = "完工单无编辑权限!"; | 
 |  |  |                         objJsonResult.data = null; | 
 |  |  |                         return objJsonResult; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     //判断是否有编辑权限 | 
 |  |  |                     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<StationBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<StationBill>>(msg2); | 
 |  |  |                 long HInterID = list[0].HInterID;//递入type得到的单据ID | 
 |  |  |                 string HBillNo = list[0].HBillNo;//递入type得到的单据号 | 
 |  |  |                 double HQty = list[0].HQty;//合格数量 | 
 |  |  |                 long HProcExchInterID = list[0].lngBillKey; | 
 |  |  |                 long HProcExchEntryID = list[0].lngBillSubKey; | 
 |  |  |                 string HProcExchBillNo = list[0].HProcExchBillNo;//流转卡 | 
 |  |  |                 string HBarCode = list[0].HBarCode;//条码 | 
 |  |  |                 string eventType = list[0].eventType; | 
 |  |  |  | 
 |  |  |                 //若MAINDI重复则重新获取 | 
 |  |  |                 oCN.BeginTran(); | 
 |  |  |                 if ("Add".Equals(eventType)) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn("select  * from Sc_StationOutBillSub_SN WITH(NOLOCK) where HInterID='" + HInterID + "' order by HEntryID desc", "Sc_StationOutBillSub_SN"); | 
 |  |  |  | 
 |  |  |                     oCN.RunProc($@"insert into Sc_StationOutBillSub_SN(HInterID,HBillNo_bak,HEntryID,HBarCode,HBarCodeQty,HMakeTime,HRemark,HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney) | 
 |  |  | values({HInterID}, '{HBillNo}', {(ds.Tables[0].Rows.Count == 0 ? 1 : int.Parse(ds.Tables[0].Rows[0]["HEntryID"].ToString()) + 1)}, '{HBarCode}', {HQty}, GETDATE(), '', " + HProcExchInterID + "," + HProcExchEntryID + ", '" + HProcExchBillNo + "', '', 0, 0)"); | 
 |  |  |  | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     oCN.RollBack(); | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "操作类型无效!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 oCN.Commit(); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "新增单据成功!"; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |                 oCN.RollBack(); | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "Exception!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 当前工单(扫码汇报) 删除出站数据 | 
 |  |  |         [Route("Cj_StationOutBill_CurrentWork/DelOutBill_SN")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DelOutBill_SN(int HInterID, string HDeleteMan,string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //判断是否有查询权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无删除权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("select * from h_v_MES_StationOutBillList_SN WITH(NOLOCK) where hmainid = " + HInterID, "h_v_MES_StationOutBillList_SN"); | 
 |  |  |                | 
 |  |  |                 if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "查无数据!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.BeginTran(); | 
 |  |  |  | 
 |  |  |                 string sql = ""; | 
 |  |  |                 if (ds.Tables[0].Rows.Count == 1) | 
 |  |  |                 { | 
 |  |  |                     sql = "delete from Sc_StationOutBillMain where HInterID = " + HInterID; | 
 |  |  |                     oCN.RunProc(sql); | 
 |  |  |                 } | 
 |  |  |                 sql = "delete from Sc_StationOutBillSub_SN where HInterID = " + HInterID ; | 
 |  |  |                 oCN.RunProc(sql); | 
 |  |  |  | 
 |  |  |                 oCN.Commit(); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 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; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region  当前工单(扫码汇报) 仪表盘查询 | 
 |  |  |         [Route("Cj_StationOutBill_CurrentWork/get_PanelDisplay")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object get_PanelDisplay(string HBarCode, string user, int HOrgID) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ds = oCN.RunProcReturn(@"select HSourceInterID,HSourceBillNo from Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill"); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = ""; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region  当前工单(赋码汇报) 根据生产订单查询数据 | 
 |  |  |         [Route("Cj_StationOutBill_CodingReport/get_ICMOProcessExchangeBillList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object get_ICMOProcessExchangeBillList(string sWhere, string user, int HOrgID) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ds = oCN.RunProcReturn("select * from h_v_Sc_ICMOProcessExchangeBillList WITH(NOLOCK) where 1=1 " + sWhere, "h_v_Sc_ICMOProcessExchangeBillList"); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = ""; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region  当前工单(赋码汇报) 查询当前用户今天生成条码的数据 | 
 |  |  |         [Route("Cj_StationOutBill_CodingReport/get_BarCodeBillList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object get_BarCodeBillList(string sWhere, string user, int HOrgID) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ds = oCN.RunProcReturn("select * from h_v_IF_BarCodeBillList WITH(NOLOCK) where 1=1 " + sWhere, "h_v_IF_BarCodeBillList"); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = ""; | 
 |  |  |                 objJsonResult.data = ds.Tables[0]; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |             catch (Exception e) | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "0"; | 
 |  |  |                 objJsonResult.count = 0; | 
 |  |  |                 objJsonResult.Message = "没有返回任何记录!" + e.ToString(); | 
 |  |  |                 objJsonResult.data = null; | 
 |  |  |                 return objJsonResult; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 当前工单(扫码汇报) 删除出站数据 | 
 |  |  |         [Route("Cj_StationOutBill_CodingReport/DelBarCodeBill_SN")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object DelBarCodeBill_SN(int HInterID, string HDeleteMan, string HBillSubType) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //判断是否有查询权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("Gy_BarCodeBillList_Edit", 1, false, HDeleteMan)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "无删除权限!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn("select * from h_v_IF_BarCodeBillList WITH(NOLOCK) where hmainid = " + HInterID, "h_v_IF_BarCodeBillList"); | 
 |  |  |  | 
 |  |  |                 if (ds.Tables[0].Rows.Count == 0) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "查无数据!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 oCN.BeginTran(); | 
 |  |  |  | 
 |  |  |                 string sql = ""; | 
 |  |  |                 sql = "delete from Gy_BarCodeBill where HItemID = " + HInterID; | 
 |  |  |                 oCN.RunProc(sql); | 
 |  |  |  | 
 |  |  |                 oCN.Commit(); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  |                 objJsonResult.Message = "Sucess!"; | 
 |  |  |                 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; | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |     } | 
 |  |  | } |