From 19d0afadbe1c90e227b852db0a97ae413e90691f Mon Sep 17 00:00:00 2001
From: wtt <1985833171@qq.com>
Date: 星期日, 29 九月 2024 19:13:25 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs |  168 ++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 132 insertions(+), 36 deletions(-)

diff --git a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
index 95f0e3c..2c8f87c 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -277,6 +277,19 @@
                             return objJsonResult;
                         }
                     }
+                    //鍒ゆ柇褰撳墠宸ュ崟鏄惁寮�宸�
+                    else if (oSystemParameter.omodel.MES_StationOutBill_MustBeginWorkCtl == "Y")
+                    {
+                        ds = oCN.RunProcReturn("select * from Sc_ICMOBillStatus_Tmp where HSourceID = '" + HSourceID + "' and HICMOBillNo = '" + HICMOBillNo + "' and HInterID = '" + HICMOInterID + "' and hicmostatus =1", "Sc_ICMOBillStatus_Tmp");
+                        if (ds.Tables[0].Rows[0]["HICMOStatus"].ToString() != "1")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "褰撳墠宸ュ崟涓嶆槸寮�宸ョ姸鎬佷笉鑳芥眹鎶ワ紒";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                    }
                     else {
                         if (HQty + HWasterQty <= 0)
                         {
@@ -465,37 +478,37 @@
                 }
                 //涓昏〃
 
-                //LogService.Write($"5.绯荤粺鎺у埗鏌ヨ鍒ゆ柇锛岀敤鏃�" + sw.Elapsed);
-                //ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl");
-                //if (ds == null)
-                //{
-                //    oCN.RollBack();
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鍒ゆ柇鏁伴噺澶辫触锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
-                //LogService.Write($"5.1锛岀敤鏃�" + sw.Elapsed);
-                //if (ds.Tables[0].Rows.Count == 0)
-                //{
-                //    oCN.RollBack();
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鍒ゆ柇鏁伴噺澶辫触锛�";
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
-                //LogService.Write($"5.2锛岀敤鏃�" + sw.Elapsed);
-                //if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
-                //{
-                //    oCN.RollBack();
-                //    objJsonResult.code = "0";
-                //    objJsonResult.count = 0;
-                //    objJsonResult.Message = "鏁伴噺鎺у埗," + ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
-                //    objJsonResult.data = null;
-                //    return objJsonResult;
-                //}
+                LogService.Write($"5.绯荤粺鎺у埗鏌ヨ鍒ゆ柇锛岀敤鏃�" + sw.Elapsed);
+                ds = oCN.RunProcReturn("exec h_p_MES_StationOutBill_QtyCtrl " + HInterID + "", "h_p_MES_StationOutBill_QtyCtrl");
+                if (ds == null)
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒ゆ柇鏁伴噺澶辫触锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                LogService.Write($"5.1锛岀敤鏃�" + sw.Elapsed);
+                if (ds.Tables[0].Rows.Count == 0)
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鍒ゆ柇鏁伴噺澶辫触锛�";
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
+                LogService.Write($"5.2锛岀敤鏃�" + sw.Elapsed);
+                if (ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBack"]) == "2")
+                {
+                    oCN.RollBack();
+                    objJsonResult.code = "0";
+                    objJsonResult.count = 0;
+                    objJsonResult.Message = "鏁伴噺鎺у埗," + ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
+                    objJsonResult.data = null;
+                    return objJsonResult;
+                }
                 LogService.Write($"6.鍒ゆ柇缁撴潫锛岀敤鏃�" + sw.Elapsed);
                 oCN.RunProc("exec h_p_Mes_ProcessExchangeRelationQty_Out " + HInterID + "," + num + "");
                 LogService.Write($"6.1锛岀敤鏃�" + sw.Elapsed);
@@ -1696,6 +1709,93 @@
                 objJsonResult.code = "0";
                 objJsonResult.count = 0;
                 objJsonResult.Message = "Exception锛�" + e.ToString();
+                objJsonResult.data = null;
+                return objJsonResult;
+            }
+        }
+        #endregion
+
+        #region 杩斿洖宸ュ簭鍑虹珯姹囨姤鍗曞垪琛�     20240926鏂板
+        [Route("Cj_StationOutBillController/GetSc_StationOutBillList_Json")]
+        [HttpGet]
+        public object GetSc_StationOutBillList_Json(string sWhere, string HMaker, string HBillSubType, string OperationType, string ViewName)
+        {
+            try
+            {
+                List<object> columnNameList = new List<object>();
+                //鍒ゆ柇鏉冮檺
+                if (HBillSubType == "SUB")
+                {
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Sub_Query", 1, false, HMaker))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "瀹屽伐鍗曟棤鏌ヨ鏉冮檺!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+                else if(OperationType == "1")
+                {
+                    //鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
+                    if (!DBUtility.ClsPub.Security_Log("Cj_StationOutBill_Query", 1, false, HMaker))
+                    {
+                        objJsonResult.code = "0";
+                        objJsonResult.count = 0;
+                        objJsonResult.Message = "鍑虹珯鍗曟棤鏌ヨ鏉冮檺!";
+                        objJsonResult.data = null;
+                        return objJsonResult;
+                    }
+                }
+
+                //鑾峰彇绯荤粺鍙傛暟
+                string Ret = "";
+                if (oSystemParameter.ShowBill(ref Ret))
+                {
+                    //鍒ゆ柇瀹㈡埛涓洪緳灞辨苯閰�
+                    if (oSystemParameter.omodel.WMS_CampanyName == "榫欏北姹介厤")
+                    {
+                        //鑾峰彇闇�瑕佹嫾鎺ョ殑瀛楃涓�
+                        string sql_splice = DBUtility.ClsPub.SpliceSQL(HMaker, "宸ュ簭姹囨姤鍗曞垪琛�");
+
+                        if (sql_splice == "娌℃湁鏌ヨ鍒扮浉鍏崇敤鎴蜂俊鎭�")
+                        {
+                            objJsonResult.code = "0";
+                            objJsonResult.count = 0;
+                            objJsonResult.Message = "娌℃湁鏌ヨ鍒扮浉鍏崇敤鎴蜂俊鎭�!";
+                            objJsonResult.data = null;
+                            return objJsonResult;
+                        }
+                        else
+                        {
+                            sWhere += sql_splice;
+                        }
+                    }
+                }
+
+                //杩斿洖鍒楄〃淇℃伅
+                ds = oCN.RunProcReturn("select * from " + ViewName + " where 1=1 " + sWhere + " order by hmainid desc", ViewName);
+
+                //娣诲姞鍒楀悕
+                foreach (DataColumn col in ds.Tables[0].Columns)
+                {
+                    Type dataType = col.DataType;
+                    string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+                    columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+                }
+                objJsonResult.code = "0";
+                objJsonResult.count = 1;
+                objJsonResult.Message = "鎴愬姛锛�";
+                objJsonResult.data = ds.Tables[0];
+                objJsonResult.list = columnNameList;
+                return objJsonResult;
+            }
+            catch (Exception e)
+            {
+                objJsonResult.code = "0";
+                objJsonResult.count = 0;
+                objJsonResult.Message = "鏌ヨ鍒楄〃淇℃伅澶辫触锛�" + e.ToString();
                 objJsonResult.data = null;
                 return objJsonResult;
             }
@@ -3683,11 +3783,7 @@
         {
             try
             {
-                string sql = @"SELECT  b.HMouldID,c.HMouldNo 妯″叿缂栫爜,c.HName 妯″叿鍚嶇О,c.HModel 妯″叿鍨嬪彿 FROM Sc_ICMOBillStatus_Tmp a  LEFT JOIN(
-                            SELECT *, ROW_NUMBER() OVER(PARTITION BY HSourceID ORDER BY HScanDate DESC) AS RowNum FROM Sc_MouldUpperBillSub
-                            ) b ON a.HSourceID = b.HSourceID AND b.RowNum = 1 left join Gy_MouldFileMain c on b.HMouldID = c.HInterID
-                            where b.HMouldID is not null and a.HSourceInterID ='" + HInterID + "' and  a.HSourceEntryID ='" + HEntryID + "' and  a.HSourceBillNo ='" + HBillNo + "'";
-                ds = oCN.RunProcReturn(sql, "Sc_ICMOBillStatus_Tmp");
+                ds = oCN.RunProcReturn("exec h_p_StationOutBill_Model  '" + HInterID + "','"+ HEntryID + "' ,'" + HBillNo + "'", "h_p_StationOutBill_Model");
 
                 if (ds.Tables[0].Rows.Count != 0 && ds != null)
                 {

--
Gitblit v1.9.1