From a337884d722031d546303d9e8cafd9fb21a108da Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期五, 01 十一月 2024 10:08:18 +0800
Subject: [PATCH] 单品过站扫条码优化 进站单优化 钉钉同步优化

---
 WebAPI/DLL/ClsSc_MESBeginWorkBill.cs                             |   15 +++++--
 WebAPI/Controllers/CJGL/Cj_SingleStationController.cs            |   17 ++++++++
 WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs     |   17 ++++++++
 WebAPI/Controllers/数据同步/钉钉同步/DD_DataSynchronizationController.cs |   22 +++++-----
 WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs         |   12 +++++-
 LMES/LMES.csproj                                                 |    2 
 6 files changed, 66 insertions(+), 19 deletions(-)

diff --git a/LMES/LMES.csproj b/LMES/LMES.csproj
index c15f85c..82a0261 100644
--- a/LMES/LMES.csproj
+++ b/LMES/LMES.csproj
@@ -12,6 +12,7 @@
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <IsWebBootstrapper>false</IsWebBootstrapper>
+    <TargetFrameworkProfile />
     <PublishUrl>publish\</PublishUrl>
     <Install>true</Install>
     <InstallFrom>Disk</InstallFrom>
@@ -26,7 +27,6 @@
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>false</UseApplicationTrust>
     <BootstrapperEnabled>true</BootstrapperEnabled>
-    <TargetFrameworkProfile />
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <PlatformTarget>AnyCPU</PlatformTarget>
diff --git a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
index faf4efb..e890165 100644
--- a/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_SingleStationController.cs
@@ -732,6 +732,23 @@
             try
             {
                 ds = oCN.RunProcReturn(@"select * from h_v_Gy_BarCodeBill WITH(NOLOCK) where HBarCode='" + HBarCode + "'", "h_v_Gy_BarCodeBill");
+
+                //鍒ゆ柇鏉$爜鏄惁瀛樺湪鏉$爜妗f
+                if (ds.Tables[0].Rows.Count > 0)
+                {
+                    string HSourceBillNo = ds.Tables[0].Rows[0]["HSourceBillNo"].ToString();
+                    DataSet dataTable = oCN.RunProcReturn(@"select * from Sc_ProcessExchangeBillMain where HBillNo='" + HSourceBillNo + "'", "Sc_ProcessExchangeBillMain");
+                    //鍒ゆ柇鏉$爜鐨勬簮鍗� 娴佽浆鍗℃槸鍚﹁鍒犻櫎
+                    if (dataTable.Tables[0].Rows.Count == 0)
+                    {
+                        //濡傛灉婧愬崟宸茬粡鍒犻櫎  鍒欐潯鐮佷篃鍒犻櫎閲嶆柊鐢熸垚
+                        oCN.RunProc("delete from Gy_BarCodeBill where HBarCode='" + HBarCode + "'");
+
+                        //閲嶆柊鏌ヨ鏉$爜妗f 杩涘叆鏂板鏂规硶
+                        ds = oCN.RunProcReturn(@"select * from Gy_BarCodeBill where HBarCode='" + HBarCode + "'", "Gy_BarCodeBill");
+                    }
+                }
+
                 if (ds.Tables[0].Rows.Count == 0)
                 {
                     //鍒ゆ柇闀垮害鏄惁涓�29浣� 鏃犲皹杞﹂棿
diff --git a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
index 64fb9c4..b2cc2e5 100644
--- a/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
+++ b/WebAPI/Controllers/CJGL/Cj_StationEntrustInBillController.cs
@@ -238,7 +238,22 @@
                 //寰楀埌淇℃伅
                 {
                     case "HCX"://鐢熶骇璧勬簮鐮�
-                        ds = oCN.RunProcReturn("select * from h_v_Gy_SourceList  where 鏉$爜缂栧彿 = '" + BillNo + "'", "h_v_Gy_SourceList");
+                    case "htt"://鐢熶骇璧勬簮鐮�
+
+                        string sErr = "";
+                        if (oSystemParameter.ShowBill(ref sErr))
+                        {
+                            if (oSystemParameter.omodel.WMS_CampanyName == "鏉窞鏂帿灏�")
+                            {
+                                ds = oCN.RunProcReturn(@"select  s.HItemID,s.HName 鐢熶骇璧勬簮鍚嶇О,s.HNumber  from Gy_EquipFileBillMain a
+                                        left join Gy_Source s on a.HSourceID = s.HItemID
+                                        where HBarCode = '" + BillNo_PGD + "'", "Gy_EquipFileBillMain");
+                            }
+                            else {
+                                ds = oCN.RunProcReturn("select * from h_v_Gy_SourceList  where 鏉$爜缂栧彿 = '" + BillNo + "'", "h_v_Gy_SourceList");
+                            }
+                        }
+                     
                         break;
                     case "SBM"://璁惧鐮�
                         ds = oCN.RunProcReturn("select * from h_v_Gy_EquipMentList  where HItemID = '" + BillNo + "'", "h_v_Gy_EquipMentList");
diff --git a/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs b/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
index 2ef736a..a46948a 100644
--- a/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
+++ b/WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
@@ -761,6 +761,8 @@
                 return objJsonResult;
             }
 
+            LogService.Write("寮�宸�:1"+ msg1);
+
             ListModels oListModels = new ListModels();
             try
             {
@@ -869,13 +871,15 @@
                     oBill.DetailCol2.Add(oItemSub);
 
                 }
+
+                LogService.Write("寮�宸�:2" + msg1);
                 //淇濆瓨
                 //淇濆瓨瀹屾瘯鍚庡鐞�
                 bool bResult;
                 if (oBill.omodel.HInterID == 0)
                 {
-
-                        bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
+                    LogService.Write("寮�宸�:2.1" + msg1);
+                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                     if (bResult)
                     {
                         objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //杩斿洖涓籌D
@@ -883,6 +887,7 @@
                         string sReturn = "";
                         if (oSystemParameter.ShowBill(ref sReturn) == true)
                         {
+                            LogService.Write("寮�宸�:2.8");
                             objJsonResult.Verify = "Y";
                             //if (oSystemParameter.omodel.Sc_ICMOBillWorkQtyStatus_AutoCheck == "Y") //绯荤粺鍙傛暟  鑷姩瀹℃牳 
                             //{
@@ -901,6 +906,9 @@
                     bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                     objJsonResult.Verify = "N";
                 }
+
+                LogService.Write("寮�宸�:3" + msg1);
+
                 if (bResult)
                 {
 
diff --git "a/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs" "b/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs"
index 4bb6860..84d603b 100644
--- "a/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs"
+++ "b/WebAPI/Controllers/\346\225\260\346\215\256\345\220\214\346\255\245/\351\222\211\351\222\211\345\220\214\346\255\245/DD_DataSynchronizationController.cs"
@@ -2074,7 +2074,7 @@
 
                             if (getInstanceByIdResponse.Body.InstanceStatus != "COMPLETED")
                             {
-                                //continue;
+                                continue;
                             }
 
                             //寮�鍗曟棩鏈�
@@ -2168,7 +2168,7 @@
                             if (keys.Contains("selectField_lq3idkvg"))
                             {
                                 string HDate_Temp = response.Body.Result[i].FormData["selectField_lq3idkvg"].ToString();
-                                DataSet ds = oCN.RunProcReturn("select * from Gy_MouldFileMain with(nolock)  where HNumber='" + HDate_Temp + "'", "Gy_MouldFileMain");
+                                DataSet ds = oCN.RunProcReturn("select * from Gy_MouldFileMain with(nolock)  where HMouldNo='" + HDate_Temp + "'", "Gy_MouldFileMain");
                                 string HMouldID = "0";
                                 if (ds.Tables[0].Rows.Count > 0)
                                 {
@@ -2182,7 +2182,7 @@
                                 ds = oCN.RunProcReturn(@"select  a.HInterID,a.HBillNo from  Sc_MouldMaintainPlanBillMain a
                                     inner join Sc_MouldMaintainPlanBillSub b on a.HInterID = b.HInterID
                                     where a.HMouldID =" + oItem.HMouldID + " and a.HMaintainLevID = " + oItem.HMaintainLevID, "Sc_MouldMaintainPlanBillMain");
-
+                                oItem.HPlanInterID = "";
                                 if (ds.Tables[0].Rows.Count > 0) {
                                     oItem.HPlanInterID = ds.Tables[0].Rows[0]["HInterID"].ToString();
                                     oItem.HPlanNo = ds.Tables[0].Rows[0]["HInterID"].ToString();
@@ -2404,18 +2404,18 @@
                             string sql_main = "Insert Into Sc_MouldMaintainBillMain " +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HDate,HMaker,HMakeDate" +
                 ",HYear,HPeriod,HRemark,HUpDateDate" +
-                ",HPlanNo,HPlanInterID,HMouldID,HBeginDate" +
+                ",HMouldID,HBeginDate" +
                 ",HEndDate" +
-                ",HInnerBillNo,HExplanation,HMouldMaintainRuleInterID,HMaintainLevID,HLastResult" +
+                ",HInnerBillNo,HExplanation,HMouldMaintainRuleInterID,HLastResult" +
                 ",HRequestComDate,HRecentMainModule,HCumulativeModule,HProductionModule" +
                 ",HPlanInterID,HPlanNo,HMaintainLevID)" +
                 "values('" + BillType + "','" + BillType + "'," + HInterID + ",'" + oItem.HBillNo + "','"+ oItem.HDate + "','" + oItem.HOriginator + "','" + oItem.HMakeDate + "'" +
                       ",'" + DateTime.Now.Year + "','" + DateTime.Now.Month + "','"+ oItem.HRemark + "','" + oItem.HUpdateDate + "'" +
-                      ",'','0','" + oItem.HMouldID + "','" + oItem.HRepairBeginDate + "'" +
+                      ",'" + oItem.HMouldID + "','" + oItem.HRepairBeginDate + "'" +
                       ",'" + oItem.HRepairEndDate + "'" +
-                      ",'" + oItem.HInstanceID + "','',"+ HMouldMaintainRuleInterID + ",0,'OK'" +
+                      ",'" + oItem.HInstanceID + "','',"+ HMouldMaintainRuleInterID + ",'OK'" +
                       ",'"+ oItem.HRequestComDate + "'," + oItem.HRecentMainModule + "," + oItem.HCumulativeModule + "," + oItem.HProductionModule + "" +
-                      "," + oItem.HPlanInterID + "," + oItem.HPlanNo + "," + oItem.HMaintainLevID + ")";
+                      "," + (oItem.HPlanInterID == "" ? "0" : oItem.HPlanInterID) + ",'" + oItem.HPlanNo + "'," + oItem.HMaintainLevID + ")";
                             LogService.Write(sql_main);
                             oCN.RunProc(sql_main);
                             int i = 1;
@@ -2562,9 +2562,9 @@
                                 continue;
                             }
 
-                            if (oItem.HInstanceID != "9b6e108c-b7bf-45e4-910d-5629ac30d4aa") {
-                                continue;
-                            }
+                            //if (oItem.HInstanceID != "9b6e108c-b7bf-45e4-910d-5629ac30d4aa") {
+                            //    continue;
+                            //}
 
                             //璁惧缂栫爜
                             if (keys.Contains("textField_lfg9hgys"))
diff --git a/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs b/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
index 982f9d3..a7197c3 100644
--- a/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
+++ b/WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
@@ -67,6 +67,8 @@
             try
             {
                 DataSet Ds = oCn.RunProcReturn("Exec h_p_Sc_MESBeginWorkBill_AfterSaveCtrl " + HInterID.ToString() + "," + HICMOInterID.ToString() + "," + HICMOEntryID.ToString() + ",'" + HICMOBillNo + "'," + OperationType.ToString(), "h_p_Sc_MESBeginWorkBill_AfterSaveCtrl");
+                LogService.Write("寮�宸�:2.6.1");
+
                 if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                 {
                     sReturn = "淇濆瓨鍚庡垽鏂け璐ワ紒";
@@ -74,9 +76,12 @@
                 }
                 else
                 {
+                    LogService.Write("寮�宸�:2.6.2"+ Ds.Tables[0].Rows[0]["HBack"]);
                     if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HBack"]) == 1)
                     {
+                        LogService.Write("寮�宸�:2.6.3");
                         sReturn = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HRemark"]);
+                        LogService.Write("寮�宸�:2.6.4");
                         return false;
                     }
                 }
@@ -253,6 +258,7 @@
         {
             try
             {
+                LogService.Write("寮�宸�:2.2");
                 DataSet ds;
                 //寰楀埌mainid
                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
@@ -263,7 +269,7 @@
                 {
                     return false;
                 }
-
+                LogService.Write("寮�宸�:2.3");
                 //涓昏〃
                 oCn.RunProc("Insert Into Sc_MESBeginWorkBillMain " +
                 "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" +
@@ -314,7 +320,7 @@
                     oCn.RunProc(subSql);
                 }
 
-
+                LogService.Write("寮�宸�:2.4");
                 //鍐嶆楠岃瘉 淇濆瓨鏄惁 鍚堢悊
                 ds = oCn.RunProcReturn("exec h_p_JIT_MESBeginWorkBill_SaveCtrl @HInterId=" + omodel.HInterID + "", "h_p_JIT_MESBeginWorkBill_SaveCtrl");
                 if (ds == null || ds.Tables[0].Rows.Count <= 0) 
@@ -329,6 +335,7 @@
                     oCn.RollBack();
                     return false;
                 }
+                LogService.Write("寮�宸�:2.5");
 
                 //鑾峰彇鏈�杩戠殑涓婃ā鍗�  鎶婂伐鍗曡窡妯″叿杩涜缁戝畾
                 ds = oCn.RunProcReturn(@"select  HICMOInterID,HICMOEntryID,HSourceInterID,HSourceEntryID,HSourceID from Sc_ICMOBillStatus_Tmp where HInterID=" + omodel.HMainSourceInterID.ToString(), "Sc_ICMOBillStatus_Tmp");
@@ -357,14 +364,14 @@
                         }
                     }
                 }
-
+                LogService.Write("寮�宸�:2.6  " + omodel.HInterID + "," + omodel.HICMOInterID + ", " + omodel.HICMOEntryID + ", " + omodel.HICMOBillNo + ", 1");
                 //淇濆瓨鍚庢帶鍒�
                 if (!AfterSave(omodel.HInterID, omodel.HICMOInterID, omodel.HICMOEntryID, omodel.HICMOBillNo, 1, ref sReturn))
                 {
                     oCn.RollBack();
                     return false;
                 }
-
+                LogService.Write("寮�宸�:2.7");
                 sReturn = omodel.HInterID.ToString();
                 oCn.Commit();
                 return true;

--
Gitblit v1.9.1