|  |  | 
 |  |  | using Newtonsoft.Json; | 
 |  |  | using DBUtility; | 
 |  |  | using System; | 
 |  |  | using Newtonsoft.Json.Linq; | 
 |  |  | using System.Collections.Generic; | 
 |  |  |  | 
 |  |  | namespace WebAPI.Controllers.SCGL | 
 |  |  | { | 
 |  |  | 
 |  |  |             public DateTime HEndDate { get; set; }//结束时间 | 
 |  |  |             public string ProcMul { get; set; }//工段 | 
 |  |  |             public string Hmaker { get; set; }//当前登录人 | 
 |  |  |             public string Arbitrarily { get; set; }//任意参数 | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         [Route("Sc_CallGoodsBackRequestBill/JIT_CallGoodsBackRequestBillList")] | 
 |  |  | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 //查看权限 | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("JIT_ComplementGoods", 1, false, user)) | 
 |  |  |                 if (!DBUtility.ClsPub.Security_Log("JIT_ComplementGoods_Query", 1, false, user)) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  | 
 |  |  |                 CallGoodsBackRequest com = JsonConvert.DeserializeObject<CallGoodsBackRequest>(sWhere.ToString()); | 
 |  |  |  | 
 |  |  |                 ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoodsRequestBillList_Query '{com.HBeginDate}','{com.HEndDate.AddDays(1).AddSeconds(-1)}','{com.HBillNo}','{com.MaterialNumber}'," + | 
 |  |  |                     $"'{com.MaterialName}','{com.MaterialModel}','{com.HDeptName}','{com.ProcMul}','{com.Hmaker}','{com.HOrgID}'", "h_p_JIT_BackGoodsRequestBillList_Query"); | 
 |  |  |                         $"'{com.MaterialName}','{com.MaterialModel}','{com.HDeptName}','{com.ProcMul}','{com.Hmaker}','{com.HOrgID}'", "h_p_JIT_BackGoodsRequestBillList_Query"); | 
 |  |  |  | 
 |  |  |                 objJsonResult.code = "1"; | 
 |  |  |                 objJsonResult.count = 1; | 
 |  |  | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         #endregion | 
 |  |  |  | 
 |  |  |         #region 退料申请单  退料确认页面列表 | 
 |  |  |         [Route("Sc_CallGoodsBackRequestBill/JIT_BackGoodsList")] | 
 |  |  |         [HttpGet] | 
 |  |  |         public object JIT_BackGoodsList(string HInterID, string user) | 
 |  |  |         { | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoods_Load '{HInterID}'", "h_p_JIT_BackGoods_Load"); | 
 |  |  |  | 
 |  |  |                 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 退料确认  品质确认 | 
 |  |  |         //传递参数 | 
 |  |  |         public class JIT_BackGoods_PZQR { | 
 |  |  |             public int? hmainid = 0; | 
 |  |  |             public int? Hsubid = 0; | 
 |  |  |             public int? HSupID = 0; | 
 |  |  |             public int? HWHID = 0; | 
 |  |  |             public string 退料原因 { get; set; } | 
 |  |  |             public int? 退回数量 = 0; | 
 |  |  |             public int? HSPID = 0; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         [Route("Sc_CallGoodsBackRequestBill/JIT_BackGoodsList_PZQR")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object JIT_BackGoodsList_PZQR([FromBody] JObject msg) | 
 |  |  |         { | 
 |  |  |             var _value = msg["msg"].ToString(); | 
 |  |  |             string[] sArray = _value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
 |  |  |             string msg2 = sArray[0].ToString(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 msg2 = msg2.Replace("\\", ""); | 
 |  |  |                 msg2 = msg2.Replace("\n", ""); | 
 |  |  |  | 
 |  |  |                 List<JIT_BackGoods_PZQR> listCa = new List<JIT_BackGoods_PZQR>(); | 
 |  |  |                 //获取表格数据集合 | 
 |  |  |                 listCa = JsonConvert.DeserializeObject<List<JIT_BackGoods_PZQR>>(msg2.ToString()); | 
 |  |  |  | 
 |  |  |                 int a = 0; | 
 |  |  |                 for (int i = 0; i < listCa.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoods_QACheck '{listCa[i].hmainid}','{listCa[i].Hsubid}'," + | 
 |  |  |                  $"{listCa[i].HSupID},{listCa[i].HWHID},'{listCa[i].退料原因}',{listCa[i].退回数量}", "h_p_JIT_BackGoods_QACheck"); | 
 |  |  |                     if (ds.Tables[0].Rows[0][0].ToString() == "1") | 
 |  |  |                     { | 
 |  |  |                         a++; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 if (a == listCa.Count) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = ds.Tables[0].Rows[0][0].ToString(); | 
 |  |  |                     objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString()); | 
 |  |  |                     objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString(); | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else if(a>0&&a<listCa.Count) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "未全部品质确认!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else  | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = ds.Tables[0].Rows[0][0].ToString(); | 
 |  |  |                     objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString()); | 
 |  |  |                     objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString(); | 
 |  |  |                     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("Sc_CallGoodsBackRequestBill/JIT_BackGoodsList_CKJS")] | 
 |  |  |         [HttpPost] | 
 |  |  |         public object JIT_BackGoodsList_CKJS([FromBody] JObject msg) | 
 |  |  |         { | 
 |  |  |             var _value = msg["msg"].ToString(); | 
 |  |  |             string[] sArray = _value.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); | 
 |  |  |             string msg2 = sArray[0].ToString(); | 
 |  |  |             string user = sArray[1].ToString(); | 
 |  |  |             try | 
 |  |  |             { | 
 |  |  |                 msg2 = msg2.Replace("\\", ""); | 
 |  |  |                 msg2 = msg2.Replace("\n", ""); | 
 |  |  |  | 
 |  |  |                 List<JIT_BackGoods_PZQR> listCa = new List<JIT_BackGoods_PZQR>(); | 
 |  |  |                 //获取表格数据集合 | 
 |  |  |                 listCa = JsonConvert.DeserializeObject<List<JIT_BackGoods_PZQR>>(msg2.ToString()); | 
 |  |  |  | 
 |  |  |                 int a = 0; | 
 |  |  |                 for (int i = 0; i < listCa.Count; i++) | 
 |  |  |                 { | 
 |  |  |                     ds = oCN.RunProcReturn($"exec h_p_JIT_BackGoods_WHReceive {listCa[i].hmainid},{listCa[i].Hsubid}," + | 
 |  |  |                  $"{listCa[i].HSPID},'{user}'", "h_p_JIT_BackGoods_WHReceive"); | 
 |  |  |  | 
 |  |  |                     if (ds.Tables[0].Rows[0][0].ToString() == "1") | 
 |  |  |                     { | 
 |  |  |                         a++; | 
 |  |  |                     } | 
 |  |  |                 } | 
 |  |  |                 if (a == listCa.Count) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = ds.Tables[0].Rows[0][0].ToString(); | 
 |  |  |                     objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString()); | 
 |  |  |                     objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString(); | 
 |  |  |                     objJsonResult.data = ds.Tables[0]; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else if (a > 0 && a < listCa.Count) | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = "0"; | 
 |  |  |                     objJsonResult.count = 0; | 
 |  |  |                     objJsonResult.Message = "未全部仓库接收!"; | 
 |  |  |                     objJsonResult.data = null; | 
 |  |  |                     return objJsonResult; | 
 |  |  |                 } | 
 |  |  |                 else | 
 |  |  |                 { | 
 |  |  |                     objJsonResult.code = ds.Tables[0].Rows[0][0].ToString(); | 
 |  |  |                     objJsonResult.count = int.Parse(ds.Tables[0].Rows[0][0].ToString()); | 
 |  |  |                     objJsonResult.Message = ds.Tables[0].Rows[0][1].ToString(); | 
 |  |  |                     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 | 
 |  |  |     } | 
 |  |  | } |