王 垚
2022-09-08 4b5e0f4c697d21530264a2f18d6040e9ff3e602f
凯贝
4个文件已修改
89 ■■■■■ 已修改文件
DBUtility/业务单据/ClsXt_BaseBillMain.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/DLL/ClsSc_MESBeginWorkBill.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebAPI/Models/ClsSc_MESBeginWorkBillMain.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
DBUtility/ÒµÎñµ¥¾Ý/ClsXt_BaseBillMain.cs
@@ -45,5 +45,6 @@
        public Int64 HPRDORGID;
        //有效状态 
        public bool HUseFlag;
    }
}
WebAPI/Controllers/SCGL/Sc_MESBeginWorkBillController.cs
@@ -201,7 +201,7 @@
        /// <returns></returns>
        [Route("Sc_MESBeginWorkBill/DeltetMESBeginWorkBill")]
        [HttpGet]
        public object DeltetMESBeginWorkBill(string HInterID,string UserName)
        public object DeltetMESBeginWorkBill(string HInterID, string UserName)
        {
            DBUtility.ClsPub.CurUserName = UserName;
            //编辑权限
@@ -287,7 +287,7 @@
        [HttpGet]
        public object AuditProcessReportList(int HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "MES_MESBeginWorkBill_Check";
            string ModRightNameCheck = "MES_MESBeginWorkBill_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
            try
            {
@@ -467,7 +467,7 @@
        [HttpPost]
        public object SaveGetMESBeginWorkFrom([FromBody] JObject msg)
        {
            var _value = msg["msg"].ToString();
            string msg1 = _value.ToString();
            string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
@@ -496,7 +496,7 @@
                objJsonResult.data = null;
                return objJsonResult;
            }
            ListModels oListModels = new ListModels();
            try
            {
@@ -555,8 +555,19 @@
                            return objJsonResult;
                        }
                    }
                    DBUtility.ClsPub.CurUserName =oItem.HMaker;
                    ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
                    string sCapName = oClsXt_SystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
                    if (sCapName.Contains("凯贝"))
                    {
                        DataTable dt = getInfodatanow(oItem.HSourceID.ToString());
                        if (dt.Rows.Count > 0)
                        {
                            DataRow dr = dt.Rows[0];
                            oItem.HRunStatus = dr["runStu"].ToString();
                            oItem.HSourceBeginQty = Convert.ToDecimal(dr["countAll"]);
                        }
                    }
                    DBUtility.ClsPub.CurUserName = oItem.HMaker;
                    oItem.HBillType = "3787";
                    oItem.HBillSubType = "3787";
                    oItem.HBillStatus = 1;   //单据状态(1未审,2审核通过,3关闭,4作废,5审核退回,6审核中,7已阅,8已回复,9结案,10验证,11下达,12开工,13申请审批,15申请检验,16 åˆ¤å®šåˆæ ¼ï¼Œ17判定不合格)     
@@ -579,9 +590,9 @@
                bool bResult;
                if (oBill.omodel.HInterID == 0)
                {
                    bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo);
                    if (bResult)
                    if (bResult)
                    {
                        objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //返回主ID
                        //系统参数  è‡ªåŠ¨å®¡æ ¸
@@ -598,7 +609,7 @@
                            }
                        }
                    }
                }
                else
                {
@@ -607,7 +618,7 @@
                }
                if (bResult)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 1;
                    objJsonResult.Message = "保存成功!";
@@ -633,6 +644,14 @@
            }
        }
        #endregion
        public DataTable getInfodatanow(string hsoucreID)
        {
            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
            string sql = $" select HMacAddr, runStu, countAll from Gy_Source t1  left join HX_LIOTsys..Info_data_now t2 on t1.HMacAddr = t2.hid where t1.hitemid={hsoucreID}";
            DataTable dt = oCn.RunProcReturn(sql, "dt").Tables[0];
            return dt;
        }
        #region  æŠ¥å·¥å¹³å°éªŒè¯å•据状态
        [Route("Sc_MESBeginWorkBill/GetMESBeginWorkBillStaus")]
@@ -709,7 +728,7 @@
            return new SQLHelper.ClsCN().RunProcReturn(sql, "Sc_ICMOBillWorkQtyStatus_Tmp");
        }
        #endregion
        #region æŠ¥å·¥å¹³å°äº§é‡æ±‡éªŒè¯æ±‡æŠ¥æ•°é‡æ˜¯å¦è¶…出计划数量辑
        /// <summary>
        /// 
@@ -849,7 +868,7 @@
                    if (bResult)
                    {
                        objJsonResult.HInterID = DBUtility.ClsPub.sExeReturnInfo; //返回主ID
                        //系统参数  è‡ªåŠ¨å®¡æ ¸
                                                                                  //系统参数  è‡ªåŠ¨å®¡æ ¸
                        string sReturn = "";
                        if (oSystemParameter.ShowBill(ref sReturn) == true)
                        {
@@ -907,7 +926,7 @@
        /// <returns></returns>
        [Route("Sc_MESBeginWorkBill/MESProductAuditProcessReportList")]
        [HttpGet]
        public object MESProductAuditProcessReportList(int HSourceID,int HSourceInterID,int HSourceEntryID,string HSourceBillNo, int HICMOInterID,int HICMOEntryID, int HInterID, int IsAudit, string CurUserName)
        public object MESProductAuditProcessReportList(int HSourceID, int HSourceInterID, int HSourceEntryID, string HSourceBillNo, int HICMOInterID, int HICMOEntryID, int HInterID, int IsAudit, string CurUserName)
        {
            string ModRightNameCheck = "MES_ProcExchReport_Check";
            DBUtility.ClsPub.CurUserName = CurUserName;
@@ -915,7 +934,7 @@
            {
                string StrMessage = "";
                //审核权限
                if (!WebClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName,ref  StrMessage))
                if (!WebClsPub.Security_Log(ModRightNameCheck, 1, false, CurUserName, ref StrMessage))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
@@ -987,7 +1006,7 @@
                if (IsAudit == 0) //审核提交
                {
                    //审核提交
                    if (oBill.CheckBill(HSourceID, HSourceInterID,HSourceEntryID,HSourceBillNo,HICMOInterID, HICMOEntryID, lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    if (oBill.CheckBill(HSourceID, HSourceInterID, HSourceEntryID, HSourceBillNo, HICMOInterID, HICMOEntryID, lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
@@ -1040,19 +1059,19 @@
        #region æŠ¥å·¥å¹³å°äº§é‡æ±‡æŠ¥åˆ é™¤
        [Route("Sc_MESBeginWorkBill/DeltetMESProductReportBill")]
        [HttpGet]
        public object DeleteGetLineBindBillList(string HInterID,string HICMOInterID,string HICMOEntryID,string UserName)
        public object DeleteGetLineBindBillList(string HInterID, string HICMOInterID, string HICMOEntryID, string UserName)
        {
            try
            {
                oCN.BeginTran();
                //查询产量汇报临时表数量
                ds = oCN.RunProcReturn("select isnull(HQty,0) HQty,isnull(HWasterQty,0) HWasterQty,isnull(HBadQty,0) HBadQty  from Sc_ICMOBillWorkQtyStatus_Tmp where HInterID='" + HInterID + "' and HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'", "Sc_ICMOBillWorkQtyStatus_Tmp");
                double HQty =double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString());
                double HQty = double.Parse(ds.Tables[0].Rows[0]["HQty"].ToString());
                double HWasterQty = double.Parse(ds.Tables[0].Rows[0]["HWasterQty"].ToString());
                double HBadQty = double.Parse(ds.Tables[0].Rows[0]["HBadQty"].ToString());
                double sumqty = HQty + HBadQty + HWasterQty;  //汇报数量+不良+报废
                //更新产量装量临时表已汇报数量
                string sql1 = string.Format(@"update Sc_ICMOBillStatus_Tmp  set  HICMOStatus='1',HFinishFlag='0', HRelationInterID=0,HSplitRelationQty=HSplitRelationQty-" + sumqty + ",HDateFinishQty=HDateFinishQty-"+ sumqty + "   where  HICMOInterID='"+ HICMOInterID + "' and HICMOEntryID='"+ HICMOEntryID + "'");
                                                              //更新产量装量临时表已汇报数量
                string sql1 = string.Format(@"update Sc_ICMOBillStatus_Tmp  set  HICMOStatus='1',HFinishFlag='0', HRelationInterID=0,HSplitRelationQty=HSplitRelationQty-" + sumqty + ",HDateFinishQty=HDateFinishQty-" + sumqty + "   where  HICMOInterID='" + HICMOInterID + "' and HICMOEntryID='" + HICMOEntryID + "'");
                oCN.RunProc(sql1);
                //更新切换状态值
                string sql = string.Format(@"delete Sc_ICMOBillWorkQtyStatus_Tmp  where HInterID='" + HInterID + "'");
@@ -1081,8 +1100,8 @@
        #region æŠ¥å·¥å¹³å°æŠ¥æ£€ç”³è¯·ä¿å­˜
        [Route("Sc_MESBeginWorkBill/SaveGetMESProductReportBillList")]
        [HttpGet]
        public object SaveGetMESProductReportBillList(string ScMaxWork,string HSourceBillType, string workcode,int HSourceID,int HICMOInterID,int HICMOEntryID,string HMaker,string Czybm)
        {
        public object SaveGetMESProductReportBillList(string ScMaxWork, string HSourceBillType, string workcode, int HSourceID, int HICMOInterID, int HICMOEntryID, string HMaker, string Czybm)
        {
            ListModels oListModels = new ListModels();
            try
            {
@@ -1110,9 +1129,9 @@
                //}
                string sHSourceType = HSourceBillType;
                string  BillType = "3711";  //单据类型 (生产汇报单)
                //得到mainid
                 long HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                string BillType = "3711";  //单据类型 (生产汇报单)
                                           //得到mainid
                long HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo);
                //oCN.BeginTran();
                //根据单号、资源ID、订单主ID、订单子ID、制单人过滤产量汇报报检申请提交数据
                //string sql = string.Format(@"update Sc_ICMOBillWorkQtyStatus_Tmp set 
@@ -1126,14 +1145,14 @@
                //ds = oCN.RunProcReturn("select top 1 * from  Sc_ICMOBillWorkQtyStatus_Tmp where HICMOReportInterID='" + HInterID + "' and HICMOReportBillNo='" + ScMaxWork + "'", "Sc_ICMOBillWorkQtyStatus_Tmp");
                //if (ds.Tables[0].Rows.Count <= 0)
                //{
                    //oCN.RollBack();
                //oCN.RollBack();
                //    objJsonResult.code = "0";
                //    objJsonResult.count = 0;
                //    objJsonResult.Message = "当前单据无产量汇报记录!";
                //    objJsonResult.data = null;
                //    return objJsonResult;
                //}
                WebS.ClsSc_ICMOReportBillMain model = new WebS.ClsSc_ICMOReportBillMain();
                model.HInterID = HInterID;
                model.HBillNo = ScMaxWork;
@@ -1148,9 +1167,9 @@
                //model.HPRDORGID = DBUtility.ClsPub.isLong(ds0.Tables[0].Rows[0]["HPRDORGID"]);
                model.HMainSourceInterID = HICMOInterID;
                model.HMainSourceEntryID = HICMOEntryID;
                //oWebs.Timeout = 30000;
                bool flag=oWebs.set_SaveICMOProductReportBill_Layui(model,workcode,HSourceID, sHSourceType, ref DBUtility.ClsPub.sErrInfo);
                bool flag = oWebs.set_SaveICMOProductReportBill_Layui(model, workcode, HSourceID, sHSourceType, ref DBUtility.ClsPub.sErrInfo);
                if (flag)
                {
                    //oCN.Commit();
@@ -1160,12 +1179,12 @@
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                else
                else
                {
                    //oCN.RollBack();
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "保存失败!"+ flag+ ";"+ DBUtility.ClsPub.sErrInfo;
                    objJsonResult.Message = "保存失败!" + flag + ";" + DBUtility.ClsPub.sErrInfo;
                    objJsonResult.data = null;
                    return objJsonResult;
                }
@@ -1184,6 +1203,6 @@
    }
}
WebAPI/DLL/ClsSc_MESBeginWorkBill.cs
@@ -163,7 +163,7 @@
                ",HProcExchBillNo,HMaterID,HProcID,HICMOQty,HPlanQty,HBeginWorkTime,HSourceID" +
                ",HSourceInterID_Main,HSourceEntryID_Main,HSourceBillNo_Main,HSourceBillType_Main" +
                ",HMainSourceInterID,HMainSourceEntryID,HMainSourceBillNo,HMainSourceBillType" +
                 ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate" +
                 ",HGroupID,HDeptID,HEmpID,HBarCode,HAddr,HBarCodeMaker,HBarCodeMakeDate,HRunStatus,HSourceBeginQty" +
                ") " +
                " values('" + this.BillType + "','" + this.HBillSubType + "'," + omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "'," + omodel.HBillStatus.ToString() + ",getdate(),'" + omodel.HMaker+ "',getdate()" +
                "," + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "'" +
@@ -171,7 +171,7 @@
                ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate()," + omodel.HSourceID.ToString() +
                ",'" + omodel.HMainSourceInterID.ToString() + "'," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo.ToString() + "','" + omodel.HMainSourceBillType.ToString() + "'" +
                ",'" + omodel.HMainSourceInterID.ToString() + "'," + omodel.HMainSourceEntryID.ToString() + ",'" + omodel.HMainSourceBillNo.ToString() + "','" + omodel.HMainSourceBillType.ToString() + "'" +
                "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" +
                "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate(),'"+ omodel.HRunStatus + "','"+ omodel.HSourceBeginQty.ToString() + "'" +
              ") ");
                //再次验证 ä¿å­˜æ˜¯å¦ åˆç†
WebAPI/Models/ClsSc_MESBeginWorkBillMain.cs
@@ -31,7 +31,8 @@
        public String HBarCodeMaker;
        public DateTime HBarCodeMakeDate;
        new public string HMainSourceEntryID;
        public string HRunStatus;
        public decimal HSourceBeginQty;
        //public int HSourceInterID_Main;
        //public int HSourceEntryID_Main;
        //public string HSourceBillNo_Main;