From e10378d6f1531d0355a3ec7304fc4d98ad4e5519 Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期二, 07 一月 2025 10:48:44 +0800
Subject: [PATCH] 1

---
 WebAPI/Controllers/数据同步/钉钉同步/DD_DataSynchronizationController.cs |   46 +++++++++++++++++++++++++++++++---------------
 1 files changed, 31 insertions(+), 15 deletions(-)

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 71947dc..ac770ab 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"
@@ -2343,7 +2343,7 @@
                                         HMouldID = ds.Tables[0].Rows[0]["HInterID"].ToString();
                                         if (HMouldStaus != HStaus && DateTime.Parse(HUpdateDate) <= DateTime.Parse(oItem.HUpdateDate)) {
                                             //淇敼妯″叿鐨勭姸鎬佸拰鏃堕棿
-                                            oCN.RunProc("update Gy_MouldFileMain set HMouldStatus='" + HStaus + "',HCloseDate='" + oItem.HUpdateDate + "' WHERE HInterID =" + HMouldID);
+                                            oCN.RunProc("update Gy_MouldFileMain set HMouldUseStatus='" + HStaus + "',HCloseDate='" + oItem.HUpdateDate + "' WHERE HInterID =" + HMouldID);
                                         }
                                     }
                                 }
@@ -2370,7 +2370,7 @@
                                     if (HMouldStaus != HStaus && DateTime.Parse(HUpdateDate) <= DateTime.Parse(oItem.HUpdateDate))
                                     {
                                         //淇敼妯″叿鐨勭姸鎬佸拰鏃堕棿
-                                        oCN.RunProc("update Gy_MouldFileMain set HMouldStatus='" + HStaus + "',HCloseDate='" + oItem.HUpdateDate + "' WHERE HInterID =" + HMouldID);
+                                        oCN.RunProc("update Gy_MouldFileMain set HMouldUseStatus='" + HStaus + "',HCloseDate='" + oItem.HUpdateDate + "' WHERE HInterID =" + HMouldID);
                                     }
                                 }
                                 oItem.HMouldID = long.Parse(HMouldID);
@@ -3278,6 +3278,11 @@
                     {
                         continue;
                     }
+                    string result = getProcessInstanceResponse.Body.Result.Result.ToString();
+                    if (result != "agree")
+                    {
+                        continue;
+                    }
                     string[] deptNameAndGroupName = getProcessInstanceResponse.Body.Result.OriginatorDeptName.Split('-');//鑾峰彇閮ㄩ棬鎷兼帴瀛楃涓叉暟缁�
                     oItem.HDeptName = deptNameAndGroupName[1];
                     oItem.HGroupName = deptNameAndGroupName[deptNameAndGroupName.Length-1];
@@ -3302,11 +3307,11 @@
                     }
                     oItem.HMangerID = int.Parse(HMangerID);
                     //澶勭悊閮ㄩ棬鍜岀彮缁勫悕绉癷d
-                    ds = oCN.RunProcReturn("select * from Gy_Department with(nolock)  where HName='" + oItem.HDeptName + "'", "Gy_Department");
+                    ds = oCN.RunProcReturn("select * from h_v_GroupList with(nolock)  where 鐝粍鍚嶇О='" + oItem.HGroupName + "'", "h_v_GroupList");
                     string HDeptID = "0";
                     if (ds.Tables[0].Rows.Count > 0)
                     {
-                        HDeptID = ds.Tables[0].Rows[0]["HItemID"].ToString();
+                        HDeptID = ds.Tables[0].Rows[0]["HDeptID"].ToString();
                     }
                     oItem.HDeptID = int.Parse(HDeptID);
                     ds = oCN.RunProcReturn("select * from Gy_Group with(nolock)  where HName='" + oItem.HGroupName + "'", "Gy_Group");
@@ -3330,10 +3335,18 @@
                     //寰幆閬嶅巻鑾峰彇鑱屽憳鍚嶇Оid锛屽伐鏃�
                     for (int i = 0; i < rows.Count; i++)
                     {
+                        if (rows[i].RowValue.Count<10)
+                        {
+                            continue;
+                        }
                         string[] nameArray = rows[i].RowValue[4].Value.ToString().Split(',');//鑾峰彇姣忎釜浜虹殑浜哄悕
                         oItem.HPlanQty += double.Parse(rows[i].RowValue[2].Value.ToString());//璁″垝鏁伴噺
                         for (int j = 0; j < int.Parse(rows[i].RowValue[5].Value.ToString()); j++)
                         {
+                            if (nameArray.Length < j + 1)//闃叉鍑虹幇浜虹鑱屼簡璁℃椂鍗曠敵璇峰畬浜嗗鑷存妧鏈汉鍛樹笌璁℃椂浜烘暟涓嶄竴鑷寸殑闂
+                            {
+                                continue;
+                            }
                             Pay_ErrWorkTimesRequestBillSub pay_ErrWorkTimesRequestBillSub = new Pay_ErrWorkTimesRequestBillSub();
                             ds = oCN.RunProcReturn("select * from Gy_Employee with(nolock)  where HName='" + nameArray[j] + "'", "Gy_Employee");
                             string HEmpID = "0";
@@ -3391,7 +3404,7 @@
             {
                 oCN.BeginTran();
                 //鍒犻櫎鏃堕棿鑼冨洿鍐呯殑瀵煎叆鍗曟嵁
-                DataSet dataSet = oCN.RunProcReturn(@"select HInterID from Pay_ErrWorkTimesRequestBillMain a with(nolock) where a.HRemark like '%閽夐拤瀵煎叆%' and HDate >= '" + startTime + "' and HDate<='" + endTime + "'", "Pay_ErrWorkTimesRequestBillMain");
+                DataSet dataSet = oCN.RunProcReturn(@"select HInterID from Pay_ErrWorkTimesRequestBillMain a with(nolock) where a.HRemark like '%閽夐拤瀵煎叆%' and a.HIsImport = 1 and HDate >= '" + startTime + "' and HDate<='" + endTime + "'", "Pay_ErrWorkTimesRequestBillMain");
                 if(dataSet != null && dataSet.Tables[0].Rows.Count > 0)
                 {
                     foreach (DataRow row in dataSet.Tables[0].Rows)
@@ -3413,13 +3426,13 @@
                         int HPeriod = int.Parse(oItem.HDate.Split('-')[1]);
                         //涓昏〃
                         string sql = "insert into Pay_ErrWorkTimesRequestBillMain" +
-                        "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID,HGroupID,HMangerID,HICMOInterID,HICMOBillNo,HExplanation,HSumRequestTimes,HMaterID,HUnitID,HPlanQty,HBatchNo,HRemark,HMaker,HMakeDate) " +
+                        "(HYear,HPeriod,HBillType,HBillSubType,HBillStatus,HInterID,HBillNo,HDate,HInnerBillNo,HDeptID,HGroupID,HMangerID,HICMOInterID,HICMOBillNo,HExplanation,HSumRequestTimes,HMaterID,HUnitID,HPlanQty,HBatchNo,HRemark,HMaker,HMakeDate,HChecker,HCheckDate,HIsImport) " +
                         "values(" +
                         "" + HYear +
                         "," + HPeriod +
                         ",'" + HBillType +
                         "','" + " " +
-                        "'," + 1 +
+                        "'," + 2 +
                         "," + HInterID +
                         ",'" + HBillNo +
                         "','" + oItem.HDate +
@@ -3438,6 +3451,9 @@
                         "','" + oItem.HRemark +
                         "','" + "System" +
                         "'," + "GETDATE()" +
+                        ",'" + "System" +
+                        "'," + "GETDATE()" +
+                        "," + "1" +
                         ")";
                         //涓昏〃
                         LogService.Write(sql);
@@ -3571,14 +3587,14 @@
             string msg = "";
             try
             {
-                if (getData_ErrWorkTimesRequest(startTime,endTime,ref msg) == false)
-                {
-                    objJsonResult.code = "0";
-                    objJsonResult.count = 0;
-                    objJsonResult.Message = "Exception锛�" + msg;
-                    objJsonResult.data = null;
-                    return objJsonResult;
-                }
+                //if (getData_ErrWorkTimesRequest(startTime,endTime,ref msg) == false)
+                //{
+                //    objJsonResult.code = "0";
+                //    objJsonResult.count = 0;
+                //    objJsonResult.Message = "Exception锛�" + msg;
+                //    objJsonResult.data = null;
+                //    return objJsonResult;
+                //}
 
                 objJsonResult.code = "1";
                 objJsonResult.count = 1;

--
Gitblit v1.9.1