yl
2024-06-17 cd23b00f03ac749e998a823a530f277772e734af
1.设备清单查看SOP,获取SOP文件列表接口
2.报工反审核接口
已修改7个文件
158 ■■■■■ 文件已修改
VueWebCoreApi/Controllers/DeviceManagerController.cs 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/WorkOrderController.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/DeviceManagerBLL.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/BLL/WorkOrderBLL.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/DeviceManagerDAL.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/ReportManagerDAL.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
VueWebCoreApi/Controllers/DeviceManagerController.cs
@@ -142,6 +142,22 @@
        }
        #endregion
        #region[设备信息查看SOP]
        /// <summary>
        /// 设备信息查看SOP
        /// </summary>
        /// <param name="eqptypecode">设备类型编码</param>
        /// <param name="eqpcode">设备编码</param>
        /// <returns></returns>
        [Route(template: "DeviceSopSearch")]
        [HttpGet]
        public JsonResult DeviceSopSearch(string eqptypecode,string eqpcode)
        {
            mes = DeviceManagerBLL.DeviceSopSearch(eqptypecode,eqpcode);
            return Json(mes);
        }
        #endregion
        #region[设备点检项列表查询]
VueWebCoreApi/Controllers/WorkOrderController.cs
@@ -725,5 +725,23 @@
            return Json(mes);
        }
        #endregion
        #region[生产执行,报工弃审数据提交]
        /// <summary>
        /// 生产执行,报工弃审数据提交
        /// </summary>
        /// <param name="id">报工记录id</param>
        /// <param name="steptype">工序类型</param>
        /// <returns></returns>
        [Route(template: "MesOrderStepReportNotVerifySeave")]
        [HttpPost]
        public JsonResult MesOrderStepReportNotVerifySeave(string id, string steptype)
        {
            var token = HttpContext.Request.Headers["Token"].ToString();
            User us = JwtTools.Denocode(token.ToString());
            mes = WorkOrderBLL.MesOrderStepReportNotVerifySeave(us, id, steptype);
            return Json(mes);
        }
        #endregion
    }
}
VueWebCoreApi/DLL/BLL/DeviceManagerBLL.cs
@@ -107,6 +107,13 @@
        }
        #endregion
        #region[设备信息查看SOP]
        public static ToMessage DeviceSopSearch(string eqptypecode, string eqpcode)
        {
            return DeviceManagerDAL.DeviceSopSearch(eqptypecode,eqpcode);
        }
        #endregion
        #region[设备点检项列表查询]
        public static ToMessage DeviceCheckItemSearch(string checkitemcode, string checkitemname, string checkdescr, string isqrcode, string cycle, int startNum, int endNum, string prop, string order)
VueWebCoreApi/DLL/BLL/WorkOrderBLL.cs
@@ -223,5 +223,12 @@
            return WorkOrderDAL.MesOrderStepReportVerifySeave(us,json);
        }
        #endregion
        #region[生产执行,报工弃审数据提交]
        public static ToMessage MesOrderStepReportNotVerifySeave(User us, string id, string steptype)
        {
            return WorkOrderDAL.MesOrderStepReportNotVerifySeave(us, id, steptype);
        }
        #endregion
    }
}
VueWebCoreApi/DLL/DAL/DeviceManagerDAL.cs
@@ -698,6 +698,44 @@
        }
        #endregion
        #region[设备信息查看SOP]
        public static ToMessage DeviceSopSearch(string eqptypecode, string eqpcode)
        {
            string sql = "";
            var dynamicParams = new DynamicParameters();
            try
            {
                //获取SOP文件信息
                sql = @"select filename,filepath,version from TDeviceSop
                        where eqptypecode=@eqptypecode and eqpcode=@eqpcode
                        order by version";
                dynamicParams.Add("@eqptypecode", eqptypecode);
                dynamicParams.Add("@eqpcode", eqpcode);
                var data = DapperHelper.selectdata(sql, dynamicParams);
                if (data.Rows.Count > 0)
                {
                    mes.code = "200";
                    mes.message = "查询成功!";
                    mes.data = data;
                }
                else
                {
                    mes.code = "300";
                    mes.message = "当前设备暂无SOP文件!";
                    mes.data = null;
                }
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
        #region[设备点检项列表查询]
        public static ToMessage DeviceCheckItemSearch(string checkitemcode, string checkitemname, string checkdescr, string isqrcode, string cycle, int startNum, int endNum, string prop, string order)
VueWebCoreApi/DLL/DAL/ReportManagerDAL.cs
@@ -287,7 +287,7 @@
                // --------------查询指定数据--------------
                var total = 0; //总条数
                var sql = @"select distinct A.id,K.wkshp_code,F.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,T.stepcode,T.stepname,A.task_qty,G.usergroupcode,G.usergroupname,A.good_qty,
                            isnull(P.stepprice,0) as unprice,A.good_qty*isnull(P.stepprice,0) as usermoney,U.username as lm_user,A.lm_date,B.report_date
                            isnull(A.step_price,0) as unprice,A.good_qty*isnull(A.step_price,0) as usermoney,U.username as lm_user,A.lm_date,B.report_date
                            from TK_Wrk_Record A
                            inner join TK_Wrk_RecordSub B on A.id=B.m_id
                            inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code 
@@ -413,7 +413,7 @@
                var total = 0; //总条数
                var sql = @"select distinct K.wkshp_code as 车间编码,F.torg_name as 车间名称, A.wo_code as 工单编号,M.partcode as 产品编码,M.partname as 产品名称,M.partspec as 产品规格,
                            T.stepcode as 工序编码,T.stepname as 工序名称,A.task_qty as 任务数量,G.usergroupcode as 班组编码,G.usergroupname as 班组名称,
                            A.good_qty as 报工数量,isnull(P.stepprice,0) as 工序单价,A.good_qty*isnull(P.stepprice,0) as 计件工资,U.username as 操作人员,A.lm_date as 操作时间,B.report_date as 报工时间
                            A.good_qty as 报工数量,isnull(A.step_price,0) as 工序单价,A.good_qty*isnull(A.step_price,0) as 计件工资,U.username as 操作人员,A.lm_date as 操作时间,B.report_date as 报工时间
                            from TK_Wrk_Record A
                            inner join TK_Wrk_RecordSub B on A.id=B.m_id
                            inner join TK_Wrk_Step P on A.wo_code=P.wo_code and A.step_code=P.step_code
VueWebCoreApi/DLL/DAL/WorkOrderDAL.cs
@@ -3392,7 +3392,7 @@
                            }
                        });
                        //回写对应的报工记录主表合格数量、不良数量、报废数量
                        sql = @"update TK_Wrk_Record set start_qty=start_qty+@good_qty, good_qty=good_qty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
                        sql = @"update TK_Wrk_Record set step_price=@step_price,start_qty=start_qty+@good_qty, good_qty=good_qty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
                            updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
                            where wo_code=@wo_code and step_code=@step_code and id=@id and style='B'";
                        list.Add(new
@@ -3400,6 +3400,7 @@
                            str = sql,
                            parm = new
                            {
                                step_price=decimal.Parse(json[0].unprice),
                                good_qty = decimal.Parse(json[0].report_dvalue),
                                ng_qty = this_ng_dvalue,
                                laborbad_qty = this_laborbad_dvalue,
@@ -3494,7 +3495,7 @@
                            }
                        });
                        //回写对应的收料记录主表收料数量、不良数量、报废数量
                        sql = @"update TK_Wrk_OutRecord set sqty=sqty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
                        sql = @"update TK_Wrk_OutRecord set step_price=@step_price,sqty=sqty+@good_qty,ng_qty=ng_qty+@ng_qty,laborbad_qty=laborbad_qty+@laborbad_qty,materielbad_qty=materielbad_qty+@materielbad_qty,
                            updatereportuser=@updatereportuser,updatereportdate=@updatereportdate
                            where wo_code=@wo_code and step_code=@step_code and id=@id and style='S' and wx_code=@wx_code";
                        list.Add(new
@@ -3502,6 +3503,7 @@
                            str = sql,
                            parm = new
                            {
                                step_price=decimal.Parse(json[0].unprice),
                                good_qty = decimal.Parse(json[0].report_dvalue),
                                ng_qty = this_ng_dvalue,
                                laborbad_qty = this_laborbad_dvalue,
@@ -3779,5 +3781,67 @@
            return mes;
        }
        #endregion
        #region[生产执行,报工弃审数据提交]
        public static ToMessage MesOrderStepReportNotVerifySeave(User us, string id, string steptype)
        {
            var sql = "";
            List<object> list = new List<object>();
            var dynamicParams = new DynamicParameters();
            try
            {
                if (steptype == "Z")//自制工序
                {
                    //回写报工记录主表审核状态、审核人、审核时间
                    sql = @"update TK_Wrk_Record set verify='N',verifyuser=@verifyuser,verifydate=@verifydate  where id=@id";
                    list.Add(new { str = sql, parm = new { verifyuser = "", verifydate = "", id = id } });
                    //回写报工记录子表审核状态、审核人、审核时间
                    sql = @"update TK_Wrk_RecordSub set verify='N',verifyuser=@verifyuser,verifydate=@verifydate  where m_id=@id";
                    list.Add(new { str = sql, parm = new { verifyuser = "", verifydate = "", id = id } });
                }
                if (steptype == "W")//外协工序
                {
                    //回写外协记录主表审核状态、审核人、审核时间
                    sql = @"update TK_Wrk_OutRecord set verify='N',verifyuser=@verifyuser,verifydate=@verifydate  where id=@id";
                    list.Add(new { str = sql, parm = new { verifyuser = "", verifydate = "", id = id } });
                    //回写外协记录子表审核状态、审核人、审核时间
                    sql = @"update TK_Wrk_OutRecordSub set verify='N',verifyuser=@verifyuser,verifydate=@verifydate  where m_id=@id";
                    list.Add(new { str = sql, parm = new { verifyuser = "", verifydate = "", id = id } });
                }
                bool aa = DapperHelper.DoTransaction(list);
                if (aa)
                {
                    if (steptype == "Z")
                    {
                        //写入操作记录表
                        LogHelper.DbOperateLog(us.usercode, "报工弃审", "自制报工记录id:" + string.Join(",", id), us.usertype);
                    }
                    if (steptype == "W")
                    {
                        LogHelper.DbOperateLog(us.usercode, "报工弃审", "外协收料记录id:" + string.Join(",", id), us.usertype);
                    }
                    mes.code = "200";
                    mes.count = 0;
                    mes.message = "审核成功!";
                    mes.data = null;
                }
                else
                {
                    mes.code = "300";
                    mes.count = 0;
                    mes.message = "审核失败!";
                    mes.data = null;
                }
            }
            catch (Exception e)
            {
                mes.code = "300";
                mes.count = 0;
                mes.message = e.Message;
                mes.data = null;
            }
            return mes;
        }
        #endregion
    }
}