From 169fc6fb192054d1f521e5b0532cc6de2e20fd57 Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期五, 23 十二月 2022 13:19:13 +0800
Subject: [PATCH] 新增委外领料、委外补料校验上传方法

---
 WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs |   51 +++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs b/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
index 3381916..8281cd6 100644
--- a/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_CallGoodsBackRequestBillController.cs
@@ -30,6 +30,7 @@
             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")]
@@ -59,7 +60,7 @@
                 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;
@@ -149,6 +150,7 @@
             public int? HWHID = 0;
             public string 閫�鏂欏師鍥� { get; set; }
             public int? 閫�鍥炴暟閲� = 0;
+            public int? HSPID = 0;
         }
 
         [Route("Sc_CallGoodsBackRequestBill/JIT_BackGoodsList_PZQR")]
@@ -221,14 +223,51 @@
             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", "");
 
-                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;
+                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)
             {

--
Gitblit v1.9.1