From 11281b148b7a04f9cb6ace20850b4f5d832c984f Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 08 六月 2023 10:37:27 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |  230 ++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 145 insertions(+), 85 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 425a577..ae497c1 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -10,6 +10,7 @@
 using System.IO;
 using System.Web;
 using System.Web.Http;
+using System.Windows.Forms;
 using WebAPI.Models;
 
 namespace WebAPI.Controllers
@@ -39,6 +40,7 @@
                 //鍙嶅簭鍒楀寲
                 string msg2 = "[" + sArray[0].ToString() + "]";
                 string user = sArray[1].ToString();//鐢ㄦ埛鍚�
+                string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
 
                 //鍒ゆ柇鏄惁鏈夌紪杈戞潈闄�
                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Edit", 1, false, user))
@@ -118,6 +120,7 @@
                 double HWorkTimes = list[0].HWorkTimes;//宸ユ椂
                 long HQCCheckID = list[0].HQCCheckID;//妫�楠屽憳ID
                 long HPRDOrgID = list[0].HPRDOrgID;//缁勭粐ID
+                double HmaterOutqty = list[0].HmaterOutqty;//鐧藉澂鍙戝竷
                 //鍗曟嵁瀹屾暣鎬у垽鏂�
                 if (HProcExchInterID <= 0)
                 {
@@ -190,7 +193,7 @@
                 if (oSystemParameter.ShowBill(ref Ret))
                 {
                     //鍒ゆ柇瀹㈡埛涓嶄负榫欏北姹介厤
-                    if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤") //绯荤粺鍙傛暟                      
+                    if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤"&& oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�") //绯荤粺鍙傛暟                      
                     {
                         if (HSourceID == 0)
                         {
@@ -302,6 +305,7 @@
                     ",HSupID,HQty,HPrice,HMoney,HBadCount,HCenterID,HProcNo,HOrderProcNO,HSourceNameList" +
                     ",HMainSourceInterID,HMainSourceBillNo,HMainSourceBillType,HLastSubProc" +
                     ",HEmpID2,HEmpID3,HEmpID4,HEmpID5,HDSQty,HChongQty,HPriceRate,HWorkTimes,HQCCheckID,HMainInterID,HPRDOrgID" +
+                        ",HmaterOutqty" +
                     ") " +
                     " values('" + BillType + "','" + HBillSubType + "'," + HInterID + ",'" + HBillNo + "'," + HBillStatus + ",getdate(),'" + HMaker + "',getdate(),'" + HMouldNum + "'" +
                     "," + HYear + "," + HPeriod + ",'" + HRemark + "','" + HSourceName + "'," + HPieceQty + "," + HWasterQty + "," + HPlanPieceQty + "," + HBadPNL +
@@ -311,7 +315,10 @@
                     "," + HSupID + "," + HQty + "," + HPrice + "," + HMoney + "," + HBadCount + "," + HCenterID + "," + HProcNo + ",'" + HOrderProcNO + "'" + ",'" + HSourceNameList + "'" +
                     "," + HMainSourceInterID + ",'" + HMainSourceBillNo + "','" + HMainSourceBillType + "'," + Convert.ToString(HLastSubProc ? 1 : 0) +
                     "," + HEmpID2 + "," + HEmpID3 + "," + HEmpID4 + "," + HEmpID5 + "," + HDSQty + "," + HChongQty + "," + HPriceRate + "," + HWorkTimes + "," + HQCCheckID + "," + HMainInterID + "," + HPRDOrgID +
-                    ") ");
+                     ","+ HmaterOutqty + ") ");
+
+                    LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",鏂板宸ュ簭鍑虹珯鍗曟嵁:" + HBillNo);
+                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "鏂板宸ュ簭鍑虹珯鍗曟嵁锛�" + HBillNo + "','LMES-宸ュ簭鍑虹珯妯″潡','" + DBUtility.ClsPub.IPAddress + "','鏂板鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else if ("Modify".Equals(eventType))
                 {
@@ -344,6 +351,9 @@
                     ",HWasterQty=" + HWasterQty +
                     ",HLastSubProc=" + Convert.ToString(HLastSubProc ? 1 : 0) +
                     " where HInterID=" + HInterID);
+
+                    LogService.Write("鐢ㄦ埛:" + user + ",鏃ユ湡:" + DateTime.Now + ",淇敼宸ュ簭鍑虹珯鍗曟嵁:" + HBillNo);
+                    oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + user + "','" + HComputerName + "','" + "淇敼宸ュ簭鍑虹珯鍗曟嵁锛�" + HBillNo + "','LMES-宸ュ簭鍑虹珯妯″潡','" + DBUtility.ClsPub.IPAddress + "','淇敼鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
                 }
                 else
                 {
@@ -442,7 +452,7 @@
                 string sReturn = "";
                 if (oSystemParameter.ShowBill(ref sReturn) == true)
                 {
-                    if (oSystemParameter.omodel.MES_StationOutBill_SaveAutoAddnew == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
+                    if (oSystemParameter.omodel.MES_StationOutBill_SaveAutoAddnew == "Y") //绯荤粺鍙傛暟  椤甸潰淇濆瓨鑷姩鍙樻垚鏂板鐘舵��
                     {
                         objJsonResult.Verify = "Y";
                     }
@@ -1893,7 +1903,7 @@
         {
             try
             {
-
+                string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
                 //缂栬緫鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan))
                 {
@@ -1906,14 +1916,22 @@
                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
                 if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                 {
-                    if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin"))
+                    string sReturn = "";
+                    if (oSystemParameter.ShowBill(ref sReturn))
                     {
-                        objJsonResult.code = "0";
-                        objJsonResult.count = 0;
-                        objJsonResult.Message = "鍙兘鍒犻櫎鏈汉鐨勫崟鎹紒";
-                        objJsonResult.data = null;
-                        return objJsonResult;
+                        if (oSystemParameter.omodel.MES_StationOutBill_DeleteCtl == "Y")
+                        {
+                            if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin"))
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鍙兘鍒犻櫎鏈汉鐨勫崟鎹紒";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
                     }
+                   
 
                     SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                     DataSet ds;
@@ -1955,8 +1973,6 @@
                         return objJsonResult;
                     }
 
-                    //鍐欏叆鍒犻櫎鏃ュ織 
-                    string WorkList = "鍒犻櫎鍑虹珯鍗曪細" + oBill.omodel.HBillNo;
                     if (!oBill.DeleteBill(oBill.omodel.HInterID, oBill.omodel.HProcExchInterID, oBill.omodel.HProcExchEntryID, ref DBUtility.ClsPub.sExeReturnInfo))
                     {
                         objJsonResult.code = "0";
@@ -1967,6 +1983,10 @@
                     }
                     else
                     {
+                        //鍐欏叆鍒犻櫎鏃ュ織 
+                        LogService.Write("鐢ㄦ埛:" + HDeleteMan + ",鏃ユ湡:" + DateTime.Now + ",鍒犻櫎宸ュ簭鍑虹珯鍗曟嵁:" + oBill.omodel.HBillNo);
+                        oCN.RunProc("Insert into System_log (GeginDate, userid, WorkstationName, WorkList, SystemName, NetuserName, State) select GETDATE(),'" + HDeleteMan + "','" + HComputerName + "','" + "鍒犻櫎宸ュ簭鍑虹珯鍗曟嵁锛�" + oBill.omodel.HBillNo + "','LMES-宸ュ簭鍑虹珯妯″潡','" + DBUtility.ClsPub.IPAddress + "','鍒犻櫎鍗曟嵁'", ref DBUtility.ClsPub.sExeReturnInfo);
+
                         objJsonResult.code = "1";
                         objJsonResult.count = 1;
                         objJsonResult.Message = "鍒犻櫎鎴愬姛锛�";
@@ -2108,7 +2128,7 @@
         #region 瀹℃牳
         [Route("Cj_StationOutBill/set_CheckBill")]
         [HttpGet]
-        public object set_CheckBill(int HInterID, string CurUserName)
+        public object set_CheckBill(string HInterID, string CurUserName)
         {
             try
             {
@@ -2122,54 +2142,64 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-
-                if (HInterID == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                var HBillNo = HInterID.Split(',');
                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
-                //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
-                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+
+                for (int i = 0; i < HBillNo.Length; i++)
                 {
-                    if (oBill.omodel.HChecker.Trim() != "")
+                    if (HBillNo[i] == "0")
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳";
+                        objJsonResult.Message = "绗�"+(i+1)+"琛�:鍗曟嵁ID涓�0锛屼笉鑳藉鏍革紒";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                    //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+                    if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo))
+                    {
+                        if (oBill.omodel.HChecker.Trim() != "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "绗�" + (i + 1) + "琛�:鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "绗�" + (i + 1) + "琛�:鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
                 }
-                else
+
+                int j = 0;
+                for (int i = 0; i < HBillNo.Length; i++)
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                //瀹℃牳
-                if (Cj_StationOutBillCheckBill(HInterID, CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "瀹℃牳鎴愬姛!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //瀹℃牳
+                    if (Cj_StationOutBillCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
+                    {
+                        j += 1;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎴愬姛:" + j + "琛�,绗�" + (i + 1) + "琛�:瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
 
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍏ㄩ儴鎵ц鎴愬姛!";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {
@@ -2226,7 +2256,7 @@
         #region 鍙嶅鏍�
         [Route("Cj_StationOutBill/set_AbandonCheck")]
         [HttpGet]
-        public object set_AbandonCheck(int HInterID, string CurUserName)
+        public object set_AbandonCheck(string HInterID, string CurUserName)
         {
             try
             {
@@ -2241,52 +2271,82 @@
                     return objJsonResult;
                 }
 
-                if (HInterID == 0)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁ID涓�0锛屼笉鑳藉弽瀹℃牳锛�";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                var HBillNo = HInterID.Split(',');
                 DAL.ClsSc_StationOutBill oBill = new DAL.ClsSc_StationOutBill();
-                //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
-                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
+
+                //鑾峰彇绯荤粺鍙傛暟
+                string Ret = "";
+                oSystemParameter.ShowBill(ref Ret);
+
+                    for (int i = 0; i < HBillNo.Length; i++)
                 {
-                    if (oBill.omodel.HChecker.Trim() == "")
+                    if (long.Parse(HBillNo[i]) == 0)
                     {
                         objJsonResult.code = "0";
                         objJsonResult.count = 0;
-                        objJsonResult.Message = "鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                        objJsonResult.Message = "绗�" + (i + 1) + "琛�:鍗曟嵁ID涓�0锛屼笉鑳藉弽瀹℃牳锛�";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+
+                    //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
+                    if (oBill.ShowBill(long.Parse(HBillNo[i]), ref DBUtility.ClsPub.sExeReturnInfo))
+                    {
+                        if (oBill.omodel.HChecker.Trim() == "")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "绗�" + (i + 1) + "琛�:鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+
+                        //瀹℃牳浜哄繀椤诲拰鍙嶅鏍镐汉淇濇寔涓�鑷�  涔斾竴
+                        if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴")
+                        {
+                            if (oBill.omodel.HChecker.Trim() != CurUserName)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "绗�" + (i + 1) + "琛�:瀹℃牳浜哄拰鍙嶅鏍镐汉涓嶄竴鑷�!";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "绗�" + (i + 1) + "琛�:鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
                         objJsonResult.data = null;
                         return objJsonResult;
                     }
                 }
-                else
+
+                int j = 0;
+                for (int i = 0; i < HBillNo.Length; i++)
                 {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = null;
-                    return objJsonResult;
+                    //鍙嶅鏍�
+                    if (Cj_StationOutBillAbandonCheckBill(long.Parse(HBillNo[i]), CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
+                    {
+                        j += 1;
+                    }
+                    else
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鎴愬姛:" + j + "琛�,绗�" + (i + 1) + "琛�:鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
                 }
-                //鍙嶅鏍�
-                if (Cj_StationOutBillAbandonCheckBill(HInterID, CurUserName, oBill.omodel.HLastSubProc, ref DBUtility.ClsPub.sExeReturnInfo))
-                {
-                    objJsonResult.code = "1";
-                    objJsonResult.count = 1;
-                    objJsonResult.Message = "鍙嶅鏍告垚鍔�!";
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
-                else
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo;
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+
+                objJsonResult.code = "1";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鍏ㄩ儴鎵ц鎴愬姛!";
+                objJsonResult.data = null;
+                return objJsonResult;
             }
             catch (Exception e)
             {

--
Gitblit v1.9.1