1
沈泽
2021-08-27 d3b2b4ed9036646d58dc1e998e2a30c9383db6ed
WebAPI/Controllers/SCGL/Sc_QualityReportBillController.cs
@@ -13,11 +13,13 @@
    //生产汇报Controller
    public class Sc_ICMOReportBillController : ApiController
    {
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;//单据状态(新增,修改,浏览,更新单价,变更)
        private json objJsonResult = new json();
        SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
        DataSet ds;
        public DAL.ClsSc_ICMOReportBill BillNew = new DAL.ClsSc_ICMOReportBill();   //对应单据类
        public DAL.ClsSc_ICMOReportBill BillOld = new DAL.ClsSc_ICMOReportBill();   //对应单据类
        #region  生产汇报单
@@ -143,23 +145,74 @@
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            string msg2 = sArray[0].ToString();
            string msg3 = sArray[1].ToString();
            string refSav = sArray[2].ToString();
            string UserName = "";
            string s = "";
            ListModels oListModels = new ListModels();
            try
            {
                DLL.ClsSc_ICMOReportBill oBill = new DLL.ClsSc_ICMOReportBill();
                List<Model.ClsSc_ICMOReportBillMain> lsmain = new List<Model.ClsSc_ICMOReportBillMain>();
                List<Models.ClsSc_ICMOReportBillMain> lsmain = new List<Models.ClsSc_ICMOReportBillMain>();
                msg2 = msg2.Replace("\\", "");
                msg2 = msg2.Replace("\n", "");  //\n
                lsmain = oListModels.getObjectByJson_Gy_ICMOReportBillMain(msg2);
                foreach (Model.ClsSc_ICMOReportBillMain oItem in lsmain)
                foreach (Models.ClsSc_ICMOReportBillMain oItem in lsmain)
                {
                    if (refSav == "Add")
                    {
                        //单据号是否重复
                        if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "单据号重复!不允许保存!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    if (refSav == "Update")
                    {
                        if (BillOld.ShowBill(oItem.HInterID, ref s) == false)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据有误!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        //判断是否可编辑
                        if (BillOld.omodel.HChecker != ""&& BillOld.omodel.HChecker != null)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据已经被审核,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (BillOld.omodel.HBillStatus > 1)
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                        if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(BillOld, ref s))
                        {
                            objJsonResult.code = "0";
                            objJsonResult.count = 0;
                            objJsonResult.Message = s + ",不允许修改";
                            objJsonResult.data = 1;
                            return objJsonResult;
                        }
                    }
                    //oItem.HMaker = "";
                    UserName = oItem.HMaker;  //制单人
                    oItem.HBillType = "3711";
                    oItem.HBillSubType = "3711";
                    oItem.HBillStatus = 1;   //单据状态(1未审,2审核通过,3关闭,4作废,5审核退回,6审核中,7已阅,8已回复,9结案,10验证,11下达,12开工,13申请审批,15申请检验,16 判定合格,17判定不合格)
                    //oItem.HBillNo = "";    //单据号
                    //oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd"));//  --日期
                    //oItem.HInnerBillNo = "";  //  --内部单据号
@@ -194,10 +247,10 @@
                msg3 = msg3.Replace("\\", "");
                msg3 = msg3.Replace("\n", "");  //\n
                //msg2 = msg2.Replace("'", "’");
                List<Model.ClsSc_ICMOReportBillSub> ls = new List<Model.ClsSc_ICMOReportBillSub>();
                List<Models.ClsSc_ICMOReportBillSub> ls = new List<Models.ClsSc_ICMOReportBillSub>();
                ls = oListModels.getObjectByJson_Gy_ICMOReportBillSub(msg3);
                int i = 0;
                foreach (Model.ClsSc_ICMOReportBillSub oItemSub in ls)
                foreach (Models.ClsSc_ICMOReportBillSub oItemSub in ls)
                {
                    i++;
@@ -210,7 +263,7 @@
                    oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now);
                    oItemSub.HCloseType = false;   //关闭类型
                    //oItemSub.HRemark = "";         //备注
                    oItemSub.HSourceInterID = 0;     // 源单主内码
                    oItemSub.HSourceInterID =0;     // 源单主内码
                    oItemSub.HSourceEntryID = 0;   //源单子内码
                    //oItemSub.HSourceBillNo = "";  //源单单号
                    //oItemSub.HSourceBillType = ""; //源单类型
@@ -282,7 +335,7 @@
            //    return objJsonResult;
            //}
            string s = "";
            Int64 lngBillKey = 0;
            lngBillKey = DBUtility.ClsPub.isLong(HInterID);
            if (lngBillKey == 0)
@@ -304,7 +357,7 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (oBill.omodel.HChecker != "")
                if (BillOld.omodel.HChecker != "")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -312,7 +365,14 @@
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (!DBUtility.Xt_BaseBillFun.Fun_AllowDeleteBill(BillOld, ref s))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = s + ",不允许删除";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
                if (IsDete)
                {