From 5466e02176f2acf2f08ef1c16315c3185bae903f Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期一, 19 五月 2025 15:53:34 +0800
Subject: [PATCH] 异常反馈单,快捷开工接口调整

---
 WebAPI/Controllers/POStockInBillController.cs |  166 +++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 154 insertions(+), 12 deletions(-)

diff --git a/WebAPI/Controllers/POStockInBillController.cs b/WebAPI/Controllers/POStockInBillController.cs
index 2924faf..80202ac 100644
--- a/WebAPI/Controllers/POStockInBillController.cs
+++ b/WebAPI/Controllers/POStockInBillController.cs
@@ -995,12 +995,12 @@
                         bool flag3 = dataSet5.Tables[0].Rows.Count > 0;
                         if (!flag3)
                         {
-                            POStockInBillController postockInBillController = new POStockInBillController();
-                            //鎵簮鍗曟柟娉�
-                            postockInBillController.set_SavePonderationBillMain_Temp_Source_Fast_Json("1103", text5, hinterid, HBillNo);
+                            //POStockInBillController postockInBillController = new POStockInBillController();
+                            ////鎵簮鍗曟柟娉�
+                            //postockInBillController.set_SavePonderationBillMain_Temp_Source_Fast_Json("1103", text5, hinterid, HBillNo);
 
-                            //WEBSController webscontroller4 = new WEBSController();
-                            //object obj4 = webscontroller4.Get_SourceBarCode_PoStockIn_Json(hinterid, HBillNo, HBillType, text5, "1103", HMaker, HOrgID,1, oSystemParameterMain, ref DBUtility.ClsPub.sErrInfo);
+                            WEBSController webscontroller4 = new WEBSController();
+                            object obj4 = webscontroller4.get_SourceBarCode_POStockIn_Json(hinterid, HBillNo, HBillType, text5, "1103", HMaker, HOrgID);
 
 
 
@@ -1066,8 +1066,11 @@
                         bool flag4 = dataSet6.Tables[0].Rows.Count > 0;
                         if (!flag4)
                         {
-                            POStockInBillController postockInBillController2 = new POStockInBillController();
-                            postockInBillController2.set_SavePonderationBillMain_Temp_Source_Fast_Json("1103", text5, hinterid, HBillNo);
+                            //POStockInBillController postockInBillController2 = new POStockInBillController();
+                            //postockInBillController2.set_SavePonderationBillMain_Temp_Source_Fast_Json("1103", text5, hinterid, HBillNo);
+
+                            WEBSController webscontroller4 = new WEBSController();
+                            object obj4 = webscontroller4.get_SourceBarCode_POStockIn_Json(hinterid, HBillNo, HBillType, text5, "1103", HMaker, HOrgID);
                         }
                     }
                 }
@@ -4436,6 +4439,7 @@
                             jobject16.Add("FSRCENTRYID", dataRow2["FENTRYID"].ToString());
                             jobject16.Add("FORDERBILLNO", dataRow2["FBILLNO"].ToString());
                             jobject16.Add("FPOORDERENTRYID", dataRow2["FENTRYID"].ToString());
+                            jobject16.Add("FGiveAway", dataRow2["FGIVEAWAY"].ToString());//鏄惁璧犲搧
                             //jobject16.Add("FPrice", dataRow2["FPRICE"].ToString());
                             //jobject16.Add("FTaxPrice", dataRow2["FTAXPRICE"].ToString());
                             //jobject16.Add("FEntryTaxRate", dataRow2["FTAXRATE"].ToString());
@@ -5009,7 +5013,16 @@
         {
             try
             {
-                string _msg = msg["msg"].ToString();
+                string HMaker ="";           //鍒跺崟浜�
+                var _value = msg["msg"].ToString();
+                string msg1 = _value.ToString();
+                string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+                string _msg = sArray[0].ToString();
+                if(sArray.Length>1)
+                {
+                    HMaker = sArray[1].ToString();
+                }
+
                 _msg = _msg.Replace("\\", "");
                 _msg = _msg.Replace("\n", "");
                 List<Models.ReciveBill_FastModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ReciveBill_FastModel>>(_msg);
@@ -5057,6 +5070,7 @@
 ,D.FSUPPLIERID,DS.FNUMBER AS FSUPPLIERNUMBER,D.FPURCHASEORGID,DOO.FNUMBER AS FPURCHASEORGNUMBER,CROO.FNUMBER  AS FSETTLEORGNUMBER,
 E.FPRICETIMEPOINT,E.FSETTLECURRID,EC.FNUMBER AS FSETTLECURRNUMBER,C.FMATERIALID,CM.FNUMBER AS FMATERIALNUMBER ,C.FUNITID 
 ,CU.FNUMBER AS FUNITNUMBER,CR.FPRICE,CR.FTAXPRICE,CR.FTAXRATE,D.FPURCHASERID,isnull(T4.FNUMBER,'') AS FPURCHASERNUMBER
+,C.FGIVEAWAY AS FGIVEAWAY   
 FROM CG_POINSTOCKBILLSUB B  
 JOIN CG_POINSTOCKBILLMAIN M ON B.HINTERID = M.HINTERID
 JOIN {0}..T_PUR_POORDERENTRY C ON B.HSOURCEINTERID = C.FID AND B.HSOURCEENTRYID = C.FENTRYID
@@ -5140,6 +5154,7 @@
                                 FentityModel.Add("FPrice", item["FPRICE"].ToString());//鍗曚环
                                 FentityModel.Add("FTaxPrice", item["FTAXPRICE"].ToString());//鍚◣鍗曚环
                                 FentityModel.Add("FEntryTaxRate", item["FTAXRATE"].ToString());//绋庣巼
+                                FentityModel.Add("FGiveAway", item["FGIVEAWAY"].ToString());//鏄惁璧犲搧
 
                                 JArray Fentity2 = new JArray();
                                 JObject FentityModel2 = new JObject();
@@ -5168,7 +5183,8 @@
                                 ["IsVerifyBaseDataField"] = "false",
                                 ["Model"] = model
                             };
-                            var loginRet = InvokeHelper.Login();
+                            //鐧诲綍
+                            var loginRet = InvokeHelper.LoginUser(HMaker);
                             var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                             if (isSuccess == 0)
                             {
@@ -5214,7 +5230,54 @@
                         LogService.Write("鏀舵枡閫氱煡鍗曞鏍告棤鏁版嵁锛�" + sql);
                     }
                 }
-                else //澶忓疂 锛屾洿鏂癳rp淇℃伅
+                else if(FCusName.Contains("澶忓疂"))
+                {
+                    JObject jsonRoot = new JObject();
+                    jsonRoot.Add("Creator", "");
+                    jsonRoot.Add("NeedUpDateFields", new JArray());
+                    jsonRoot.Add("NeedReturnFields", new JArray());
+                    jsonRoot.Add("IsDeleteEntry", "True"); //娉ㄦ剰IsDeleteEntry鍙傛暟锛屽涓篢rue锛屽垯鍘熷垎褰曡鐨凢EntryId鏈湪鍒嗗綍json鍑虹幇鐨勮锛屽皢浼氳鍒犻櫎 锛堝鏃犻渶鍒犻櫎鍒嗗綍琛岋紝鍙敼涓篺asle锛�
+                    jsonRoot.Add("SubSystemId", "");
+                    jsonRoot.Add("IsVerifyBaseDataField", "");
+
+                    JObject jsonModel = new JObject();
+                    jsonModel.Add("FID", FID);
+                    JArray Entry = new JArray();
+                    foreach (var item in list)
+                    {
+                        if (item.HSQty == 0)
+                            continue;
+                        JObject jsonFPOOrderEntry = new JObject();
+                        jsonFPOOrderEntry.Add("FEntryID", item.FEntryID);
+                        jsonFPOOrderEntry.Add("FActReceiveQty ", item.HSQty); ;
+                        Entry.Add(jsonFPOOrderEntry);
+                    }
+                    jsonModel.Add("FDetailEntity", Entry);
+                    jsonRoot.Add("Model", jsonModel);
+                    //鐧诲綍
+                    var loginRet = InvokeHelper.LoginUser(HMaker);
+                    var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
+                    if (isSuccess <= 0)
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = loginRet;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());
+                    //LogService.Write(result);
+                    if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+                    {
+                        LogService.Write("鏀舵枡閫氱煡鍗曚慨鏀瑰け璐sonRoot:" + jsonRoot.ToString());
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曟洿鏂板け璐�" + result;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else //鏇存柊erp淇℃伅
                 {
                     JObject jsonRoot = new JObject();
                     jsonRoot.Add("Creator", "");
@@ -5238,7 +5301,8 @@
                     }
                     jsonModel.Add("FDetailEntity", Entry);
                     jsonRoot.Add("Model", jsonModel);
-                    var loginRet = InvokeHelper.Login();
+                    //鐧诲綍
+                    var loginRet = InvokeHelper.LoginUser(HMaker);
                     var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
                     if (isSuccess <= 0)
                     {
@@ -5311,6 +5375,82 @@
 
         }
 
+        [Route("POStockInBillList/AuditPOInStockBillPost_TianKang")]
+        [HttpGet]
+        public object AuditPOInStockBill_TianKang(long FID,string user)
+        {
+            try
+            {
+                //string _msg = msg["msg"].ToString();
+                //_msg = _msg.Replace("\\", "");
+                //_msg = _msg.Replace("\n", "");
+                //List<Models.ReciveBill_FastModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Models.ReciveBill_FastModel>>(_msg);
+                //DAL.ClsCg_POInStockBill oBill = new DAL.ClsCg_POInStockBill();
+                //var hinterID = list[0].HInterID;
+                //var FID = list[0].FID;
+                //string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);//瀹㈡埛鍚嶇О               
+                //var kdTbaleName = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "DataBaseName");
+                //string sql = string.Empty;
+                                              
+                var json = new
+                {
+                    Ids = FID,
+                };
+                //LogService.Write(json);
+                //鐧诲綍
+                var loginRet = InvokeHelper.LoginUser(user);
+                var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>();
+                if (isSuccess <= 0)
+                {
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = loginRet;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                //鎻愪氦
+                var _result = InvokeHelper.Submit("PUR_ReceiveBill", JsonConvert.SerializeObject(json));
+                var _saveObj = JObject.Parse(_result);
+                if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+                {
+                    LogService.Write("鏀舵枡閫氱煡鍗曟彁浜ゅけ璐sonRoot:" + json.ToString());
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曟彁浜ゅけ璐�" + _result;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+
+                }
+                //瀹℃牳
+                _result = InvokeHelper.Audit("PUR_ReceiveBill", JsonConvert.SerializeObject(json));
+                _saveObj = JObject.Parse(_result);
+                if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE")
+                {
+                    LogService.Write("鏀舵枡閫氱煡鍗曞鏍稿け璐sonRoot:" + json.ToString());
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曞鏍稿け璐sonRoot" + _result;
+                    objJsonResult.data = null;
+                    return objJsonResult;
+
+                }
+                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 = "寮傚父锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+
         /// <summary>
         /// 鍒拌揣纭 鎵潯鐮� 鏍¢獙
         /// </summary>
@@ -5329,9 +5469,11 @@
                 string sql = string.Empty;
                 if (FCusName.Contains("瀹夌憺"))
                     sql = $"select top 1 HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID from  Gy_BarCodeBill where HSourceInterID =(select distinct HSourceInterID from Cg_POInStockBillSub where HInterID ={HInterID}) and HBarCode = '{HBarcode}' and HBarCodeType ='绠卞彿鍐呮潯鐮�'";
+                else if(FCusName.Contains("娣诲悍绉戞妧"))
+                    sql = $"select top 1 HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID,HMaterID,HBatchNo,HProduceDate,HExpiryDate from  Gy_BarCodeBill where HSourceInterID = {HInterID} and HBarCode = '{HBarcode}' and HBarCodeType ='绠卞彿鍐呮潯鐮�'";
                 else
                     sql = $"select HItemID,HSourceBillNo,HQty,HSourceInterID,HSourceEntryID from  Gy_BarCodeBill where HSourceInterID ={HInterID} and HBarCode = '{HBarcode.Split('#')[0]}' and HQty = {HBarcode.Split('#')[1]}";
-                DataSet ds = oCn.RunProcReturn(sql, "H_v_SRM_POOrderBillList");
+                DataSet ds = oCn.RunProcReturn(sql, "Gy_BarCodeBill");
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     objJsonResult.code = "0";

--
Gitblit v1.9.1