1
zrg
2024-10-29 322bb33e8e17b72874befaadcdf08f6457836ba3
WebAPI/Controllers/¹¤×ʹÜÀí/Pay_SalaryCalculateController.cs
@@ -25,6 +25,58 @@
        string user_LongShan = "";
        string HName_LongShan = "";
        #region å·¥èµ„运算
        /// <summary>
        /// æ ¹æ®å¼€å§‹æ—¥æœŸã€ç»“束日期、班组进行工资运算
        /// </summary>
        /// <returns></returns>
        [Route("Pay_SalaryCulateController/GetSalaryCalculate_Json")]
        [HttpGet]
        public object GetSalaryCalculate_Json(DateTime HBeginDate, DateTime HEndDate, Int64 HGroupID, string HSourceBillType, string HMaker, Int64 HStockOrgID)
        {
            try
            {
                ds = oCN.RunProcReturn("exec h_p_Pay_SalaryCalculate '" + HBeginDate + "','" + HEndDate + "'," + HGroupID.ToString() + ",'" + HSourceBillType + "','" + HMaker + "'," + HStockOrgID.ToString(), "h_p_Pay_SalaryCalculate");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "工资运算时出现错误,请重新运算!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else if (DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) == 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[0]["HRemark"]);
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "工资运算失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #region å·¥èµ„计算-数据查询
        /// <summary>
        /// è¿”回项目阶段列表
@@ -111,6 +163,17 @@
                    objJsonResult.Message = "无新增权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from Pay_SingleBalBillMain where HAutoCreate = 1 and CONVERT(varchar(100),HDate, 23) >= '" + HBeginDate + "' and CONVERT(varchar(100),HDate, 23) <= '" + HEndDate + "'", "Pay_SingleBalBillMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for(int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        int HInterID = int.Parse(ds.Tables[0].Rows[i]["HInterID"].ToString());
                        oCN.RunProc("delete from Pay_SingleBalBillMain where HInterID = " + HInterID);
                        oCN.RunProc("delete from Pay_SingleBalBillSub where HInterID = " + HInterID);
                    }
                }
                //获取工序出站汇报单数据
@@ -466,6 +529,18 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                ds = oCN.RunProcReturn("select * from Pay_GroupBalBillMain where HAutoCreate = 1 and CONVERT(varchar(100),HDate, 23) >= '" + HBeginDate + "' and CONVERT(varchar(100),HDate, 23) <= '" + HEndDate + "'", "Pay_GroupBalBillMain");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        int HInterID = int.Parse(ds.Tables[0].Rows[i]["HInterID"].ToString());
                        oCN.RunProc("delete from Pay_GroupBalBillMain where HInterID = " + HInterID);
                        oCN.RunProc("delete from Pay_GroupBalBillSub where HInterID = " + HInterID);
                        oCN.RunProc("delete from Pay_GroupBalBillEmp where HInterID = " + HInterID);
                    }
                }
                //获取工序出站汇报单数据