1
沈泽
2021-09-16 31eef64dd1ed760fb56518b0e7b59119613138e8
WebAPI/Controllers/Sc_CheckToolsRepairWorkBillController.cs
@@ -4064,6 +4064,145 @@
        }
        #endregion
        #region [模具处理出库单审核、反审核]
        /// <summary>
        ///
        /// </summary>
        /// <param name="HInterID">单据ID</param>
        /// <param name="IsAudit">审核(0),反审核(1)</param>
        /// <param name="CurUserName">审核人</param>
        /// <returns></returns>
        [Route("Sc_MouldScrapOutHouseBill/AuditMouldScrapOutList")]
        [HttpGet]
        public object AuditMouldScrapOutList(int HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "Sc_MouldScrapOutBill_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
                //审核权限
                if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, CurUserName))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "审核失败!无权限!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (HInterID <= 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "HInterID小于0!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(HInterID);
                DLL.ClsSc_MouldScrapOutBill oBill = new DLL.ClsSc_MouldScrapOutBill();
                //查看是否已审核,关闭,作废
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    if (oBill.omodel.HCloseMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已关闭!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HDeleteMan.Trim() != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据已作废!不能再次审核!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (IsAudit == 0)  //审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() != "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据已审核!不能再次审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                    if (IsAudit == 1) //反审核判断
                    {
                        if (oBill.omodel.HChecker.Trim() == "")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据未审核!不需要反审核!";
                            objJsonResult.data = null;
                            return objJsonResult;
                        }
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (IsAudit == 0) //审核提交
                {
                    //审核提交
                    if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                if (IsAudit == 1) //反审核提交
                {
                    //反审核提交AbandonCheck
                    if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = "反审核成功";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "反审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo;
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
        #endregion
        #endregion
        #region 模具退库单
@@ -4139,11 +4278,9 @@
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                if (sqlWhere == null || sqlWhere.Equals(""))
                {
                    ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位名称 HSecUnitName,
                                                  HUnitID, 计量单位代码 HUnitCode, 计量单位名称 HUnitName, 批次 HBatchNo,
                                                  设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife,应收数量 HQtyMust, 实收数量 HQty, 单价 HPrice, 金额 HMoney, HWHID1 HWHID, 收料仓库代码 HWHCode, 收料仓库名称 HWHName,
                                                  HSPID, 仓位代码 HSPCode, 仓位名称 HSPName,模具新规格 HNewModel,壁厚 HWallThickness,硬度 HHardness,最后生产产品 HLastProdModel, 直径 HDiameter,退库类型 HBackFlag,
                                                  表体备注 HRemark FROM h_v_Sc_MouldProdBackBillList"), "h_v_Sc_MouldProdBackBillList");
                    ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID 模具代码,设计寿命,剩余寿命,累积使用寿命,HWHID 仓库,
                                                  HSPID 仓位代码,模具新规格,最后生产产品,退库类型,
                                                  表头备注  FROM h_v_Sc_MouldProdBackBillList"), "h_v_Sc_MouldProdBackBillList");
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
@@ -4154,11 +4291,9 @@
                {
                    //string sql1 = "select HRepairCheckID,HRepairCheckContent,HManagerID,HRemark  from Sc_MouldRepairCheckBillSub where 1 = 1 ";
                    string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位名称 HSecUnitName,
                                                  HUnitID, 计量单位代码 HUnitCode, 计量单位名称 HUnitName, 批次 HBatchNo,
                                                  设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife,应收数量 HQtyMust, 实收数量 HQty, 单价 HPrice, 金额 HMoney, HWHID1 HWHID, 收料仓库代码 HWHCode, 收料仓库名称 HWHName,
                                                  HSPID, 仓位代码 HSPCode, 仓位名称 HSPName,模具新规格 HNewModel,壁厚 HWallThickness,硬度 HHardness,最后生产产品 HLastProdModel, 直径 HDiameter,退库类型 HBackFlag,
                                                  表体备注 HRemark FROM h_v_Sc_MouldProdBackBillList where 1 = 1 ");
                    string sql1 = string.Format(@"SELECT HMaterID 模具代码,设计寿命,剩余寿命,累积使用寿命,HWHID 仓库,
                                                  HSPID 仓位代码,模具新规格,最后生产产品,退库类型,
                                                  表头备注  FROM h_v_Sc_MouldProdBackBillList where 1 = 1 ");
                    string sql = sql1 + sqlWhere;
                    ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdBackBillList");