From 6a2303841730318da709f711221e04e399db32b2 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 22 八月 2023 16:00:56 +0800
Subject: [PATCH] 1
---
WebAPI/Controllers/BarCodeController.cs | 66 +++++++++++++++++++++++++++-----
1 files changed, 55 insertions(+), 11 deletions(-)
diff --git a/WebAPI/Controllers/BarCodeController.cs b/WebAPI/Controllers/BarCodeController.cs
index 48470e2..381d0f1 100644
--- a/WebAPI/Controllers/BarCodeController.cs
+++ b/WebAPI/Controllers/BarCodeController.cs
@@ -13,6 +13,8 @@
using System.Web.Script.Serialization;
using WebAPI.Code;
using WebAPI.Models;
+using WebAPI.Utility;
+
namespace WebAPI.Controllers
{
@@ -1456,15 +1458,12 @@
/// <summary>
/// 鏉$爜鐢熸垚琛ㄤ綋锛堥噰璐鍗曪級
/// </summary>
- /// <param name="sMsg"></param>
+ /// <param name="sMsg">閲囪喘璁㈠崟HinterID</param>
/// <returns></returns>
public object GetHBarCodeShowBillSubBycg(string sMsg)
{
try
{
- DataSet ds;
- string s = "";
- string ShowItem = " * ";//鏄剧ず鐨勫瓧娈�
if (DBUtility.ClsPub.isLong(sMsg) == 0)
{
objjson.code = "0";
@@ -1473,9 +1472,18 @@
objjson.data = null;
return objjson;
}
+ //棰勫鐞� 淇敼閲囪喘璁㈠崟鐨勯��鏂欐暟閲�
+ var kdTbaleName = Util.GetConfigKey(AppDomain.CurrentDomain.BaseDirectory + "/Config/kdapi.config", "DataBaseName");
+ string sql = $@"update t1 set
+ t1.HMrbQty = t2.FMRBQTY
+ from Cg_POOrderBillSub t1
+ join {kdTbaleName}..T_PUR_POORDERENTRY_R t2
+ on t1.HEntryID = t2.FENTRYID
+ where t1.HInterID = {sMsg} ";//sMsg 閲囪喘璁㈠崟hinterid
+ oCn.RunProc(sql);
DAL.ClsWeb_BarCodeBill oClsWeb_BarCodeBill = new DAL.ClsWeb_BarCodeBill();
- string sql = string.Format(@"select * from h_v_Cg_POOrderBillSub_ForWeb2 where HInterID = " + sMsg);
- ds = oCn.RunProcReturn(sql, "h_v_Cg_POOrderBillSub_ForWeb2");
+ sql = string.Format(@"select * from h_v_Cg_POOrderBillSub_ForWeb2 where HInterID = " + sMsg);
+ DataSet ds = oCn.RunProcReturn(sql, "h_v_Cg_POOrderBillSub_ForWeb2");
//ds = oClsWeb_BarCodeBill.ShowBillSub(DBUtility.ClsPub.isLong(sMsg), ShowItem, ref DBUtility.ClsPub.sExeReturnInfo);
if (ds == null || ds.Tables[0].Rows.Count == 0)
{
@@ -1518,8 +1526,8 @@
var _value = msg["msg"].ToString();
string msg1 = _value.ToString();
string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
- string msg2 = sArray[0].ToString();
- string msg3 = sArray[1].ToString();
+ string msg2 = sArray[0].ToString();//
+ string msg3 = sArray[1].ToString();//
string UserName = "";
ListModels oListModels = new ListModels();
try
@@ -1539,6 +1547,7 @@
List<Model.ClsGy_MaterialList_WMS_Model> ls = new List<Model.ClsGy_MaterialList_WMS_Model>();
List<Model.ClsGy_BarCodeBill_WMS_Model> ls2 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();//澶栫model
List<Model.ClsGy_BarCodeBill_WMS_Model> ls3 = new List<Model.ClsGy_BarCodeBill_WMS_Model>();//鍐呯model
+
ls = oListModels.getObjectByJson_MaterialList(msg3);//鍒楄〃鏁版嵁model
long linterid = Pub_Class.ClsPub.CreateBillID_SRMProd("8888", ref DBUtility.ClsPub.sExeReturnInfo);
@@ -1559,6 +1568,7 @@
string WeiShu = ""; //灏炬暟
DataSet Ds;
SQLHelper.ClsCNSRM oCn = new SQLHelper.ClsCNSRM();
+ oCn.BeginTran();
Ds = oCn.RunProcReturn("exec GetLSH '" + DateTime.Today + "'", "GetLSH");
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
foreach (Model.ClsGy_MaterialList_WMS_Model oItemSub in ls)
@@ -1567,7 +1577,7 @@
if (oItemSub.HQty == 0 || oItemSub.HMinQty == 0 || oItemSub.HWXQty == 0)
continue;
//妫�楠屾墦鍗版暟閲忥紙HQTY锛夊拰鏈墦鍗版暟閲�
- string sql = $"select HQty -HBarcodeCount as HNotBarcodeCount ,* from Cg_POOrderBillSub where HEntryID = {oItemSub.HSourceEntryID}";
+ string sql = $"select HQty + isnull(HMrbQty,0) - HBarcodeCount as HNotBarcodeCount ,* from Cg_POOrderBillSub where HEntryID = {oItemSub.HSourceEntryID}";
DataSet ds = oCn.RunProcReturn(sql, "tables");
if (ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0][0]) < oItemSub.HQty)
{
@@ -1633,6 +1643,32 @@
TM = $"{oItemSub.HMaterNumber}@{oItemSub.HMaterName}@{oItemSub.HMaterModel}@{oItemSub.HKFDate}@{HMinQty}@{oItemSub.HKFDQDate}@{oItemSub.HBatchNo.TrimStart().TrimEnd()}@{oItemSub.HSupName}@{oItemSub.HSourceBillNo}";
Model.ClsGy_BarCodeBill_WMS_Model bar = new Model.ClsGy_BarCodeBill_WMS_Model();
+ var HBarCode_verify = TM.Split('@'); //鏍¢獙鏉$爜淇℃伅
+ var HMaterNumber_verify = HBarCode_verify[0]; //鏍¢獙鐗╂枡缂栫爜
+ var HMaterName_verify = HBarCode_verify[1]; //鏍¢獙鐗╂枡鍚嶇О
+ var HMaterModel_verify = HBarCode_verify[2]; //鏍¢獙瑙勬牸鍨嬪彿
+ var HSupName_verify = HBarCode_verify[7]; //鏍¢獙渚涘簲鍟�
+ var HSourceBillNo_verify = HBarCode_verify[8]; //鏍¢獙閲囪喘璁㈠崟鍙�
+
+ sql = $"select * from Gy_Material where HNumber = '{HMaterNumber_verify}' and HName = '{HMaterName_verify}' and HModel = '{HMaterModel_verify}'";
+ DataSet verifyMatInfo = oCn.RunProcReturn(sql, "tables");
+
+ sql = $"select * from Cg_POOrderBillMain where HBillNo = '{HSourceBillNo_verify}'";
+ DataSet verifyBillInfo = oCn.RunProcReturn(sql, "tables");
+
+ sql = $"select * from Gy_Supplier where HName = '{HSupName_verify}'";
+ DataSet verifySupInfo = oCn.RunProcReturn(sql, "tables");
+
+ if (verifyMatInfo.Tables[0].Rows.Count <= 0 || verifyBillInfo.Tables[0].Rows.Count <= 0 || verifySupInfo.Tables[0].Rows.Count <= 0)
+ {
+ oCn.RollBack();
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = $"鏉$爜淇℃伅鏍¢獙鍑洪敊锛岃閲嶆柊鐢熸垚鏉$爜";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
bar.HBarCode = TM;
bar.HMaterID = oItemSub.HMaterID;
//bar.HMaterNumber = oItemSub.HMaterNumber;
@@ -1659,6 +1695,7 @@
}
}
}
+ oCn.Commit();
foreach (Model.ClsGy_BarCodeBill_WMS_Model oItemSub2 in ls2)
{
if (ClsPub.isLong(oItemSub2.HMaterID) != 0)
@@ -2000,12 +2037,19 @@
}
[Route("DeltetBarCodeBill")]
- [HttpGet]
- public object DeltetBarCodeBill(string HInterID, string HUserName)
+ [HttpPost]
+ public object DeltetBarCodeBill([FromBody] JObject oData)
{
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
try
{
+ var _value = oData["oData"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string HInter = sArray[0].ToString();
+ string HInterID = HInter.Replace("\"", "");
+ string HUserName = sArray[1].ToString();
+
string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
string sql = "select HItemID,HBarCode,HSourceInterID,HSourceEntryID,HQty,HBarCodeType,HSourceBillType from Gy_BarCodeBill where HItemID in(" + HInterID + ") ";
//LogService.Write("鍒犻櫎sql:" + sql);
--
Gitblit v1.9.1