From 1664e7f3b3ef38ecf01afb098512c733315c4d10 Mon Sep 17 00:00:00 2001
From: black-goat-me <226547893@qq.com>
Date: 星期二, 23 五月 2023 17:01:27 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |   71 +++++++++++++++++++++++++----------
 1 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index c16c7e4..9f00be0 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)
                 {
@@ -176,14 +179,6 @@
                     objJsonResult.data = null;
                     return objJsonResult;
                 }
-                //if (HEmpID == 0)
-                //{
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鎿嶄綔鍛樻病鏈夐�夋嫨锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
                 //if (HQCCheckID == 0)
                 //{
                 //    objJsonResult.code = "0";
@@ -197,8 +192,8 @@
                 string Ret = "";
                 if (oSystemParameter.ShowBill(ref Ret))
                 {
-                    //鍒ゆ柇瀹㈡埛
-                    if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤") //绯荤粺鍙傛暟   
+                    //鍒ゆ柇瀹㈡埛涓嶄负榫欏北姹介厤
+                    if (oSystemParameter.omodel.WMS_CampanyName != "榫欏北姹介厤"&& oSystemParameter.omodel.WMS_CampanyName != "鐟炰笌绁�") //绯荤粺鍙傛暟                      
                     {
                         if (HSourceID == 0)
                         {
@@ -207,10 +202,27 @@
                             objJsonResult.Message = "鐢熶骇璧勬簮娌℃湁閫夋嫨锛�";
                             objJsonResult.data = null;
                             return objJsonResult;
+                        }                                     
+                    }
+                    //鍒ゆ柇瀹㈡埛涓洪緳灞辨苯閰�
+                    else if (oSystemParameter.omodel.WMS_CampanyName == "榫欏北姹介厤")
+                    {
+                        //鍒ゆ柇鏄惁涓哄宸ヤ綅
+                        ds = oCN.RunProcReturn("select * from h_v_GetStationOutBill_Detail where 宸ュ簭ID = " + HProcID + " and 鐗╂枡ID = " + HMaterID + " and 娴佽浆鍗″彿 = '" + HProcExchBillNo + "'", "h_v_GetStationOutBill_Detail");
+                        if (ds != null && ds.Tables[0].Rows.Count <= 1)
+                        {
+                            if (HEmpID == 0)
+                            {
+                                objJsonResult.code = "0";
+                                objJsonResult.count = 0;
+                                objJsonResult.Message = "鎿嶄綔鍛樻病鏈夐�夋嫨锛�";
+                                objJsonResult.data = null;
+                                return objJsonResult;
+                            }
                         }
                     }
-
                 }
+               
                 //if (HCenterID == 0)
                 //{
                 //    objJsonResult.code = "0";
@@ -293,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 +
@@ -302,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))
                 {
@@ -335,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
                 {
@@ -1601,7 +1620,7 @@
         {
             try
             {
-
+                string HComputerName = SystemInformation.ComputerName; //璁惧鍚嶇О
                 //缂栬緫鏉冮檺
                 if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Drop", 1, false, HDeleteMan))
                 {
@@ -1614,14 +1633,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;
@@ -1663,8 +1690,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";
@@ -1675,6 +1700,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 = "鍒犻櫎鎴愬姛锛�";

--
Gitblit v1.9.1