流转卡、生产订单、工序进站单、工序出站单只能自己删除自己的单据。(所有模块,做个系统参数,删除人和制单人必须一致)
6个文件已修改
204 ■■■■■ 已修改文件
DAL/车间管理/ClsSc_ProcessExchangeBill.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Model/车间管理/ClsSc_ProcessExchangeBillMain.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationInBillController.cs 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs 154 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/Sc_ProcessMangementController.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DAL/³µ¼ä¹ÜÀí/ClsSc_ProcessExchangeBill.cs
@@ -96,6 +96,7 @@
                ",HProjectNum='" + omodel.HProjectNum.ToString() + "'" +
                ",HMateOutBatchNo='" + omodel.HMateOutBatchNo + "'" +
                ",HBLFlag='" + (omodel.HBLFlag ? 1 : 0) + "'" +
                ",HMachineLine='" + omodel.HMachineLine + "'" +
                ",HXTNumber='" + omodel.HXTNumber  + "'" +
                ",HXTModel='" + omodel.HXTModel + "'" +
                ",HRemark2='" + omodel.HRemark2 + "'" +
@@ -322,7 +323,7 @@
",HPicNumVer,HPicNumAssemble,HMaterTexture,HProductNum,HVerNum,HPRDORGID,HBLFlag,HCusNumber,HPickLabel,HPickLabelNumber,HXTNumber,HXTModel,HWorkBillSortNo" +
               ", HRoutingBillID,HMaterModel,HWidth,HWeight,HAuxQty,HAuxUnit,HSplitNo" +
               ",HHeight,HInches,HAl1Long,HDensity,HTela,HUnderTela,HSizing,HSellDate" +
               ",HRemark2,HRemark3,HEmpID,HCusID,HColorRemark,HSplitSumQty,HSplitColorQty) " +
               ",HRemark2,HRemark3,HEmpID,HCusID,HColorRemark,HSplitSumQty,HSplitColorQty,HMachineLine) " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "','" + omodel.HMaker + "',getdate()," + "" + (omodel.HPrevMainSourceInterID == 0 ? omodel.HInterID : omodel.HPrevMainSourceInterID) +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + omodel.HBatchNo + "'," + omodel.HMainMaterID.ToString() + "," + omodel.HKeyMaterID.ToString() + "," + omodel.HNo.ToString() + ",'" + omodel.HOrderProcNO + "'" +
                "," + omodel.HWWOrderInterID.ToString() + "," + omodel.HWWOrderEntryID.ToString() + ",'" + omodel.HWWOrderBillNo + "'," + omodel.HICMOInterID.ToString() + "," + omodel.HEquipMentID.ToString() +
@@ -336,7 +337,7 @@
                ",'" + omodel.HPicNumVer + "','" + omodel.HPicNumAssemble + "','" + omodel.HMaterTexture + "','" + omodel.HProductNum + "','" + omodel.HVerNum + "','"+ omodel.HPRDORGID+ "','" + (omodel.HBLFlag ? 1 : 0) + "','" + omodel.HCusNumber + "','" + omodel.HPickLabel + "','" + omodel.HPickLabelNumber + "','" + omodel.HXTNumber + "','" + omodel.HXTModel + "','" + omodel.HWorkBillSortNo + 
                "',"+ omodel.HRoutingBillID + ",'"+ omodel.HMaterModel + "',"+ omodel.HWidth + ","+ omodel.HWeight + ","+ omodel.HAuxQty + ","+ omodel.HAuxUnit +","+ omodel.HSplitNo +"" +
                ",'" + omodel.HHeight + "','" + omodel.HInches + "','" + omodel.HAl1Long + "','" + omodel.HDensity + "','" + omodel.HTela + "','" + omodel.HUnderTela + "','" + omodel.HSizing + "','" + omodel.HSellDate + "'" +
                ",'"+ omodel.HRemark2 + "','"+ omodel.HRemark3 + "',"+ omodel.HEmpID + "," + omodel.HCusID + ",'"+ omodel.HColorRemark + "',"+ omodel.HSplitSumQty + ","+ omodel.HSplitColorQty + ")");
                ",'"+ omodel.HRemark2 + "','"+ omodel.HRemark3 + "',"+ omodel.HEmpID + "," + omodel.HCusID + ",'"+ omodel.HColorRemark + "',"+ omodel.HSplitSumQty + ","+ omodel.HSplitColorQty + ",'"+ omodel.HMachineLine + "')");
                sErr = sErr + "1;";
                //插入子表
                foreach (Model.ClsSc_ProcessExchangeBillSub oSub in DetailColl)
Model/³µ¼ä¹ÜÀí/ClsSc_ProcessExchangeBillMain.cs
@@ -93,6 +93,7 @@
        public int HSplitNo;//拆分号
        public int HSplitSumQty;//拆分总量
        public int HSplitColorQty;//分缸号
        public string HMachineLine;//机台
        public string HRemark2;//备注2
        public string HRemark3;//底部备注
WebAPI/Controllers/CJGL/Cj_StationInBillController.cs
@@ -977,14 +977,22 @@
                DAL.ClsSc_StationInBill oBill = new DAL.ClsSc_StationInBill();
                if (oBill.ShowBill(HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    if (oBill.omodel.HMaker != HDeleteMan && (HDeleteMan != "admin" && HDeleteMan != "Admin"))
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn))
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "只能删除本人的单据!";
                        objJsonResult.data = null;
                        return objJsonResult;
                        if (oSystemParameter.omodel.MES_StationInBill_DeleteCtl == "Y")
                        {
                            if (oBill.omodel.HMaker != HDeleteMan)
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "只能删除本人的单据!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                        }
                    }
                    SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    DataSet ds;
WebAPI/Controllers/CJGL/Cj_StationOutBillController.cs
@@ -191,7 +191,7 @@
                if (oSystemParameter.ShowBill(ref Ret))
                {
                    //判断客户不为龙山汽配
                    if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配") //系统参数
                    if (oSystemParameter.omodel.WMS_CampanyName != "龙山汽配"|| oSystemParameter.omodel.WMS_CampanyName != "瑞与祺") //系统参数
                    {
                        if (HSourceID == 0)
                        {
WebAPI/Controllers/CJGL/Sc_ProcessExchangeBillController.cs
@@ -805,7 +805,7 @@
        /// <returns></returns>
        [Route("Sc_ProcessExchangeBill/DeltetProcessExchangeBillByID")]
        [HttpGet]
        public object DeltetProcessExchangeBillByID(string HInterID,int HPRDORGID, string user)
        public object DeltetProcessExchangeBillByID(string HInterID, int HPRDORGID, string user)
        {
            //编辑权限
            if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Drop", 1, false, user))
@@ -817,84 +817,91 @@
                return objJsonResult;
            }
            Int64 lngBillKey = 0;
            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
            if (lngBillKey == 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据ID为空!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            //删除前判断关联数量
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            DataSet ds;
            ds = oCn.RunProcReturn("select ct from (  " +
                          "  select 1 ct from Sc_StationInBillMain Where HProcExchInterID=" + lngBillKey + " " +
                          "  union all " +
                          "  select 1 from Sc_StationOutBillMain Where HProcExchInterID=" + lngBillKey + " ) as a  ", "Sc_ProcExchReportSub");
            if (ds.Tables[0].Rows.Count != 0)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "流转卡已经有下游进出站单后,不允许删除!";
                objJsonResult.data = null;
                return objJsonResult;
            }
            DAL.ClsSc_ProcessExchangeBill oBill = new DAL.ClsSc_ProcessExchangeBill();
            DBUtility.ClsPub.HOrgID = HPRDORGID;
            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            string[] HBillNo = HInterID.Split(',');
            foreach (var item in HBillNo)
            {
                string sReturn = "";
                if (oSystemParameter.ShowBill(ref sReturn))
                Int64 lngBillKey = 0;
                lngBillKey = DBUtility.ClsPub.isLong(item);
                DBUtility.ClsPub.HOrgID = HPRDORGID;
                if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                {
                    if (oSystemParameter.omodel.Sc_ProcessExchangeBill_DeleterAndMakerMustSame == "Y")
                    if (lngBillKey == 0)
                    {
                        if (oBill.omodel.HMaker != user)
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:"+ oBill .omodel.HBillNo+ "单据ID为空!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    //删除前判断关联数量
                    SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
                    DataSet ds;
                    ds = oCn.RunProcReturn("select ct from (  " +
                                  "  select 1 ct from Sc_StationInBillMain Where HProcExchInterID=" + lngBillKey + " " +
                                  "  union all " +
                                  "  select 1 from Sc_StationOutBillMain Where HProcExchInterID=" + lngBillKey + " ) as a  ", "Sc_ProcExchReportSub");
                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + "流转卡已经有下游进出站单后,不允许删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    string sReturn = "";
                    if (oSystemParameter.ShowBill(ref sReturn))
                    {
                        if (oSystemParameter.omodel.Sc_ProcessExchangeBill_DeleterAndMakerMustSame == "Y")
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "只能删除本人的单据!";
                            objJsonResult.data = null;
                            return objJsonResult;
                            if (oBill.omodel.HMaker != user)
                            {
                                objJsonResult.code = "0";
                                objJsonResult.count = 0;
                                objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + "只能删除本人的单据!";
                                objJsonResult.data = null;
                                return objJsonResult;
                            }
                        }
                    }
                }
                if (oBill.omodel.HBillStatus > 1)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据当前处于不能删除状态,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oBill.omodel.HChecker != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据已经审核,不能删除!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                    if (oBill.omodel.HBillStatus > 1)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + "单据当前处于不能删除状态,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                    if (oBill.omodel.HChecker != "")
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = "单据号:" + oBill.omodel.HBillNo + "单据已经审核,不能删除!";
                        objJsonResult.data = null;
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "单据未找到";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
            }
            foreach (var item in HBillNo)
            {
                bool IsDete = oBill.DeleteBill(long.Parse(item), ref DBUtility.ClsPub.sExeReturnInfo);
                if (!IsDete)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
@@ -902,14 +909,11 @@
                    return objJsonResult;
                }
            }
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "单据未找到";
                objJsonResult.data = null;
                return objJsonResult;
            }
            objJsonResult.code = "0";
            objJsonResult.count = 1;
            objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo;
            objJsonResult.data = null;
            return objJsonResult;
        }
        #endregion
WebAPI/Controllers/Sc_ProcessMangementController.cs
@@ -694,11 +694,21 @@
                    return objJsonResult;
                }
                //判断金蝶云生产汇报单 æ•°é‡ æ˜¯å¦ å¤§äºŽ æœ«é“出站数量
                ds= oCN.RunProcReturn($@"select sum(FFinishQty)-(select HQty from Sc_StationOutBillMain where HBillNo='{BillNo}')
from  AIS20220308151944..T_PRD_MORPT rpt3
left join AIS20220308151944..T_PRD_MORPTENTRY  rpt2 on rpt3.FID = rpt2.FID
where F_bsv_Text=(select HProcExchBillNo from Sc_StationOutBillMain where HBillNo='{BillNo}')", "SumCount");
                string sErr = "";
                if (oSystemParameter.ShowBill(ref sErr))
                {
                    if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺")
                    {
                        //判断金蝶云生产汇报单 æ•°é‡ æ˜¯å¦ å¤§äºŽ æœ«é“出站数量
                        ds = oCN.RunProcReturn($@"select sum(FFinishQty)-(select HQty from Sc_StationOutBillMain where HBillNo='{BillNo}')
                        from  AIS20220308151944..T_PRD_MORPT rpt3
                        left join AIS20220308151944..T_PRD_MORPTENTRY  rpt2 on rpt3.FID = rpt2.FID
                        where F_bsv_Text=(select HProcExchBillNo from Sc_StationOutBillMain where HBillNo='{BillNo}')", "SumCount");
                    }
                }
                if (double.Parse(ds.Tables[0].Rows[0][0].ToString()) < 0) {
                    objJsonResult.code = "0";
@@ -740,7 +750,7 @@
                    FentityModel.Add("FBaseRealQty", item["数量"].ToString());//
                    FentityModel.Add("FOwnerTypeId", "BD_OwnerOrg");//
                    FentityModel.Add("FOwnerId", new JObject() { ["FNumber"] = item["HPrdOrgNumber"].ToString() });//
                    string sErr = "";
                    if (oSystemParameter.ShowBill(ref sErr))
                    {
                        if (oSystemParameter.omodel.WMS_CampanyName == "瑞与祺")