|  |  | 
 |  |  |                     ",HSourceID5=" + HSourceID5 + | 
 |  |  |                     ",HPayProcID=" + HPayProcID + | 
 |  |  |                     ",HGroupID=" + HGroupID + | 
 |  |  |                     ",HShiftsID=" + HShiftsID + | 
 |  |  |                     ",HWorkTimes=" + HWorkTimes + | 
 |  |  |                     ",HSaveBillFlag=0 " + | 
 |  |  |                     ",HBadCount=" + HBadCount + | 
 |  |  | 
 |  |  |                     ",HWasterQty_Work=" + HWasterQty_Work + | 
 |  |  |                     ",HWasterQty_Mater=" + HWasterQty_Mater + | 
 |  |  |                     ",HBackWorkQty=" + HBackWorkQty + | 
 |  |  |                     ",HShiftsID=" + HShiftsID + | 
 |  |  |                     ",HBackWorkByMaterQty=" + HBackWorkByMaterQty + | 
 |  |  |                     ",HMouldID=" + HMouldID + | 
 |  |  |                     ",HMachineWorkTimes=" + HMachineWorkTimes + | 
 |  |  |                     ",HMachineWorkTimes=" + HMachineWorkTimes +   | 
 |  |  |                     " where HInterID=" + HInterID); | 
 |  |  |  | 
 |  |  |                     LogService.Write("用户:" + user + ",日期:" + DateTime.Now + ",修改工序出站单据:" + HBillNo); | 
 |  |  | 
 |  |  |                     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); | 
 |  |  | 
 |  |  |             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) | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     File.Delete(fileurl);      //删除指定文件 | 
 |  |  |                     files.SaveAs(fileurl); | 
 |  |  |                     string StrPath = "/files/"+ HBillNo+"/"+ filename; | 
 |  |  |                     string StrPath = "/files/Cj_StationOutBill/" + HBillNo+"/"+ filename; | 
 |  |  |                     if (File.Exists(fileurl))  | 
 |  |  |                     { | 
 |  |  |                         //这里可以执行一些其它的操作,比如更新数据库 | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     Directory.CreateDirectory(fileSavePath); //添加文件夹 | 
 |  |  |                     files.SaveAs(fileurl); | 
 |  |  |                     string StrPath = "/files/" + HBillNo + "/" + filename; | 
 |  |  |                     string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename; | 
 |  |  |                     if (File.Exists(fileurl)) | 
 |  |  |                     { | 
 |  |  |                         //这里可以执行一些其它的操作,比如更新数据库 | 
 |  |  | 
 |  |  |             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) | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     File.Delete(fileurl);      //删除指定文件 | 
 |  |  |                     files.SaveAs(fileurl); | 
 |  |  |                     string StrPath = "/files/" + HBillNo + "/" + filename; | 
 |  |  |                     string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename; | 
 |  |  |                     if (File.Exists(fileurl)) | 
 |  |  |                     { | 
 |  |  |                         //这里可以执行一些其它的操作,比如更新数据库 | 
 |  |  | 
 |  |  |                 { | 
 |  |  |                     Directory.CreateDirectory(fileSavePath); //添加文件夹 | 
 |  |  |                     files.SaveAs(fileurl); | 
 |  |  |                     string StrPath = "/files/" + HBillNo + "/" + filename; | 
 |  |  |                     string StrPath = "/files/Cj_StationOutBill/" + HBillNo + "/" + filename; | 
 |  |  |                     if (File.Exists(fileurl)) | 
 |  |  |                     { | 
 |  |  |                         //这里可以执行一些其它的操作,比如更新数据库 | 
 |  |  | 
 |  |  |         [HttpGet] | 
 |  |  |         public object Filelist(string HBillNo) | 
 |  |  |         { | 
 |  |  |             var url = fileip + "/files/" + HBillNo+"/"; | 
 |  |  |             var url = fileip + "/files/Cj_StationOutBill/" + HBillNo+"/"; | 
 |  |  |             //@"C:\\files\\" | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                 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; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #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 = "出站单无编辑权限!"; | 
 |  |  |                     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 = "修改失败没找到相关出站汇报单"; | 
 |  |  |                     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 = "修改失败该时间班组已计算工资:" + 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 = "修改失败该时间班组已计算工资:" + 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 = "修改失败该时间班组已计算工资:" + 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 = "修改失败该时间班组已计算工资:" + 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 = "Sucess!"; | 
 |  |  |                 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 出站单列表-下推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 = "无删除权限!"; | 
 |  |  |                     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 = "查无数据!"; | 
 |  |  |                     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 = "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 | 
 |  |  |     } | 
 |  |  | } |