yangle
2024-11-29 a23a1a0d44a05b60539b9984c16938d6bdfa6a77
WebAPI/Controllers/Êý¾Ýͬ²½/¶¤¶¤Í¬²½/DD_DataSynchronizationController.cs
@@ -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);
                    //处理部门和班组名称id
                    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);