From 282233a35c8c4d5dbf9eaac9aeb7dee9bed183eb Mon Sep 17 00:00:00 2001
From: 王 垚 <1402714037@qq.com>
Date: 星期三, 14 九月 2022 17:47:26 +0800
Subject: [PATCH] 优化
---
WebAPI/Controllers/POStockInBillController.cs | 192 ++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 170 insertions(+), 22 deletions(-)
diff --git a/WebAPI/Controllers/POStockInBillController.cs b/WebAPI/Controllers/POStockInBillController.cs
index 6ff55fd..3619b9b 100644
--- a/WebAPI/Controllers/POStockInBillController.cs
+++ b/WebAPI/Controllers/POStockInBillController.cs
@@ -847,8 +847,6 @@
return objJsonResult;
}
}
-
-
[Route("POStockInBill/Delete_Json")]
[HttpGet]
public object Delete_Json(long HInterID, long HMaterID, long HAuxPropID, string HMTONo, long HSourceInterID, long HSourceEntryID, string sHBillType)
@@ -985,7 +983,6 @@
}
catch (Exception)
{
-
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = "鍒犻櫎澶辫触锛�";
@@ -1003,25 +1000,27 @@
{
try
{
- SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
- string sql = $"select * from H_v_SRM_POInStockBillList where 鍗曟嵁鍙� ='{HBillno}'";
- ds = oCn.RunProcReturn(sql, "H_v_SRM_POInStockBillList");
- if (ds == null || ds.Tables[0].Rows.Count == 0)
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "Sucess锛�";
- objJsonResult.data = ds.Tables[0];
- return objJsonResult;
- }
+ json result = Get_ReciveBillCheckDate(HBillno);
+ return result;
+ //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ //string sql = $"select * from H_v_SRM_POInStockBillList where 鍗曟嵁鍙� ='{HBillno}'";
+ //ds = oCn.RunProcReturn(sql, "H_v_SRM_POInStockBillList");
+ //if (ds == null || ds.Tables[0].Rows.Count == 0)
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ //else
+ //{
+ // objJsonResult.code = "1";
+ // objJsonResult.count = 1;
+ // objJsonResult.Message = "Sucess锛�";
+ // objJsonResult.data = ds.Tables[0];
+ // return objJsonResult;
+ //}
}
catch (Exception e)
{
@@ -1411,6 +1410,11 @@
return HInterID;
}
+ /// <summary>
+ /// 鍒拌揣纭鎵敹鏂欓�氱煡鍗曞彿 鑾峰彇琛ㄤ綋鍜岃〃澶存暟鎹�
+ /// </summary>
+ /// <param name="HBarCode"></param>
+ /// <returns></returns>
public json Get_ReciveBillCheckDate(string HBarCode)
{
json objjson = new json();
@@ -1457,6 +1461,150 @@
}
}
+ [Route("POStockInBillList/AuditPOInStockBillPost")]
+ [HttpPost]
+ public object AuditPOInStockBill([FromBody] JObject msg)
+ {
+ 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;
+ oCn.BeginTran();
+ string sql = string.Empty;
+ foreach (var item in list)
+ {
+ if (item.HSQty == 0)
+ continue;
+ sql = $"update Cg_POInStockBillSub set Hqty = {item.HSQty} where HInterID ={item.HInterID} and HEntryID = {item.HEntryID}";
+ oCn.RunProc(sql);
+ }
+ oCn.RunProc("exec h_p_Cg_UpDatePOOrderRelation_Del " + hinterID);//鍒犻櫎鍏宠仈鍏崇郴
+
+ JObject jsonRoot = new JObject();
+ jsonRoot.Add("Creator", "");
+ jsonRoot.Add("NeedUpDateFields", new JArray());
+ jsonRoot.Add("NeedReturnFields", new JArray());
+ jsonRoot.Add("IsDeleteEntry", "false");
+ 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("FHQty ", item.HSQty); ;
+ Entry.Add(jsonFPOOrderEntry);
+ }
+ jsonModel.Add("FEntity", Entry);
+ jsonRoot.Add("Model", jsonModel);
+ var loginRet = InvokeHelper.Login();
+ 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;
+ }
+ //LogService.Write("jsonRoot:" + jsonRoot.ToString());
+ var result = InvokeHelper.Save("PUR_ReceiveBill", jsonRoot.ToString());
+ //LogService.Write(result);
+ if (JObject.Parse(result)["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() == "TRUE")
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "閲戣澏鏀舵枡閫氱煡鍗曟洿鏂板け璐�" + result;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ //鏇存柊鎴愬姛鍚� 鍚屾鏇存柊閲戣澏
+ 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 = "寮傚父锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+
+ /// <summary>
+ /// 鍒拌揣纭 鎵潯鐮� 鏍¢獙
+ /// </summary>
+ /// <param name="HBarcode"></param>
+ /// <param name="HInterID"></param>
+ /// <returns></returns>
+ [Route("POStockInBillList/Get_ReciveBillByBarcode")]
+ [HttpGet]
+ public object Get_ReciveBillByBarcode(string HBarcode, string HInterID)
+ {
+ try
+ {
+ //鏍¢獙鏉$爜鏄惁瀛樺湪
+ string sql = $"select* from Gy_BarCodeBill where HSourceInterID ={HInterID} and HBarCode = '{HBarcode}'";
+ DataSet ds = oCn.RunProcReturn(sql, "H_v_SRM_POOrderBillList");
+ if (ds.Tables[0].Rows.Count == 0)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "鏉$爜涓嶅瓨鍦紒";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ }
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
+ //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+ //string sql = $"select * from H_v_SRM_POInStockBillList where 鍗曟嵁鍙� ='{HBillno}'";
+ //ds = oCn.RunProcReturn(sql, "H_v_SRM_POInStockBillList");
+ //if (ds == null || ds.Tables[0].Rows.Count == 0)
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ //else
+ //{
+
+ //}
+ }
+ catch (Exception e)
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "娌℃湁杩斿洖浠讳綍璁板綍锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ }
+
//鏀舵枡閫氱煡鍗曞鏍� 瀹℃牳鎻愪氦
[Route("POStockInBillList/Exec_ReciveBillCheck")]
[HttpGet]
--
Gitblit v1.9.1