1.T8入库记录(查询、删除)
2.T+入库记录(查询、删除)
3.生产入库记录查询增加部门查询条件
4.看板视图根据配置文件区分T8还是T+
| | |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using VueWebCoreApi.DLL.BLL; |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region[入库记录] |
| | | #region[T8入库记录表头] |
| | | /// <summary> |
| | | /// 入库记录 |
| | | /// T8入库记录表头 |
| | | /// </summary> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则</param> |
| | | /// <param name="hbillno">入库单号</param> |
| | | /// <param name="sono">销售单号</param> |
| | | /// <param name="mono">订单号</param> |
| | | /// <param name="wocode">工单号</param> |
| | | /// <param name="partcode">产品编码</param> |
| | | /// <param name="partname">产品名称</param> |
| | | /// <param name="stockcode">仓库编码</param> |
| | | /// <param name="responddate">单据日期</param> |
| | | /// <param name="hbdate">单据日期</param> |
| | | /// <param name="username">操作人员</param> |
| | | /// <param name="userdate">操作时间</param> |
| | | /// <returns></returns> |
| | | [Route(template: "StorageRecordSearch")] |
| | | [Route(template: "StorageRecordMainSearch")] |
| | | [HttpGet] |
| | | public JsonResult StorageRecordSearch(int page, int rows, string prop, string order, string hbillno = null, string sono = null, string mono = null, string wocode = null, string partcode = null,string partname=null, string stockcode=null,string responddate=null) |
| | | public JsonResult StorageRecordMainSearch(int page, int rows, string prop, string order, string hbillno = null, string hbdate = null, string username = null, string userdate = null) |
| | | { |
| | | string respondopendate = ""; //单据开始时间 |
| | | string respondclosedate = ""; //单据结束时间 |
| | | if (responddate != "" && responddate != null) |
| | | string hbdateopendate = ""; //单据开始时间 |
| | | string hbdateclosedate = ""; //单据结束时间 |
| | | string userdateopendate = ""; //操作开始时间 |
| | | string userdateclosedate = ""; //操作结束时间 |
| | | if (hbdate != "" && hbdate != null) |
| | | { |
| | | respondopendate = responddate.Split('~')[0].ToString(); |
| | | respondclosedate = responddate.Split('~')[1].ToString(); |
| | | hbdateopendate = hbdate.Split('~')[0].ToString(); |
| | | hbdateclosedate = hbdate.Split('~')[1].ToString(); |
| | | } |
| | | if (userdate != "" && userdate != null) |
| | | { |
| | | userdateopendate = userdate.Split('~')[0].ToString(); |
| | | userdateclosedate = userdate.Split('~')[1].ToString(); |
| | | } |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ReportManagerBLL.StorageRecordSearch(hbillno, sono, mono, wocode, partcode, partname, stockcode, respondopendate, respondclosedate, startNum, endNum, prop, order); |
| | | mes = ReportManagerBLL.StorageRecordMainSearch(hbillno, username, hbdateopendate, hbdateclosedate, userdateopendate, userdateclosedate, startNum, endNum, prop, order); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[T8入库记录表体] |
| | | /// <summary> |
| | | /// T8入库记录表体 |
| | | /// </summary> |
| | | /// <param name="hbillno">入库单号</param> |
| | | /// <returns></returns> |
| | | [Route(template: "StorageRecordSubSearch")] |
| | | [HttpGet] |
| | | public JsonResult StorageRecordSubSearch(string hbillno = null) |
| | | { |
| | | mes = ReportManagerBLL.StorageRecordSubSearch(hbillno); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[T8入库记录删除] |
| | | /// <summary> |
| | | /// T8入库记录删除 |
| | | /// </summary> |
| | | /// <param name="dt">提交数据</param> |
| | | /// <returns></returns> |
| | | [Route(template: "StorageRecordDelete")] |
| | | [HttpPost] |
| | | public JsonResult StorageRecordDelete(DataTable dt) |
| | | { |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | mes = ReportManagerBLL.StorageRecordDelete(dt, us); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteStorageRecord")] |
| | | [HttpPost] |
| | | [ApiExplorerSettings(IgnoreApi =true)] //隐藏接口 |
| | | public JsonResult DeleteStorageRecord(List<StorageRecord> json) |
| | | { |
| | | //var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | var token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyY29kZSI6Ijk5OTkiLCJ1c2VybmFtZSI6Iuezu-e7n-euoeeQhuWRmCIsInN0b3JnX2NvZGUiOiIiLCJzdG9yZ19uYW1lIjoiIiwiaXNfc3lzdGVtX2FkbWluIjoiWSIsInJvbGVfY29kZSI6IiIsInJvbGVfZGF0YXBlcm1pc3Npb25zIjoiIiwidXNlcnR5cGUiOiJQQyIsInJlZGlza2V5IjoiTmV3TUVTTG9naW5Vc2VySURQQzk5OTkiLCJtZXNTZXR0aW5nIjoie1wicm91dGVcIjp0cnVlLFwiaXNPcmRlclwiOnRydWUsXCJkZXZpY2VcIjp0cnVlLFwidGVjaFwiOnRydWUsXCJ3b3JrT3JkZXJcIjp0cnVlLFwiZXZlcnlcIjpmYWxzZSxcImxhc3RcIjpmYWxzZX0iLCJ0aW1lb3V0IjoiMjAyNC0xMC0yNFQxMjozNTo1MC4zNDI1NzE2KzA4OjAwIn0.Nbc-1sXd4QLLsnj8wH9XC7iWEmP0wDG82gwLxIh94e4"; |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | mes = ReportManagerBLL.DeleteStorageRecord(json, us); |
| | | return Json(mes); |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "StorageRecordExcelSearch")] |
| | | [HttpGet] |
| | | [ApiExplorerSettings(IgnoreApi = true)] //隐藏接口 |
| | | public JsonResult StorageRecordExcelSearch(string hbillno = null, string sono = null, string mono = null, string wocode = null, string partcode = null,string partname=null, string stockcode = null, string responddate = null) |
| | | { |
| | | string respondopendate = ""; //单据开始时间 |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region[T+入库记录表头] |
| | | /// <summary> |
| | | /// T+入库记录表头 |
| | | /// </summary> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | | /// <param name="prop">排序字段</param> |
| | | /// <param name="order">排序规则</param> |
| | | /// <param name="hbillno">入库单号</param> |
| | | /// <param name="hbdate">单据日期</param> |
| | | /// <param name="username">操作人员</param> |
| | | /// <param name="userdate">操作时间</param> |
| | | /// <returns></returns> |
| | | [Route(template: "InStorageRecordMainSearch")] |
| | | [HttpGet] |
| | | public JsonResult InStorageRecordMainSearch(int page, int rows, string prop, string order, string hbillno = null, string hbdate = null, string username = null, string userdate = null) |
| | | { |
| | | string hbdateopendate = ""; //单据开始时间 |
| | | string hbdateclosedate = ""; //单据结束时间 |
| | | string userdateopendate = ""; //操作开始时间 |
| | | string userdateclosedate = ""; //操作结束时间 |
| | | if (hbdate != "" && hbdate != null) |
| | | { |
| | | hbdateopendate = hbdate.Split('~')[0].ToString(); |
| | | hbdateclosedate = hbdate.Split('~')[1].ToString(); |
| | | } |
| | | if (userdate != "" && userdate != null) |
| | | { |
| | | userdateopendate = userdate.Split('~')[0].ToString(); |
| | | userdateclosedate = userdate.Split('~')[1].ToString(); |
| | | } |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ReportManagerBLL.InStorageRecordMainSearch(hbillno, username, hbdateopendate, hbdateclosedate, userdateopendate, userdateclosedate, startNum, endNum, prop, order); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[T+入库记录表体] |
| | | /// <summary> |
| | | /// T+入库记录表体 |
| | | /// </summary> |
| | | /// <param name="hbillno">入库单号</param> |
| | | /// <returns></returns> |
| | | [Route(template: "InStorageRecordSubSearch")] |
| | | [HttpGet] |
| | | public JsonResult InStorageRecordSubSearch(string hbillno = null) |
| | | { |
| | | mes = ReportManagerBLL.InStorageRecordSubSearch(hbillno); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[T+入库记录删除] |
| | | /// <summary> |
| | | /// T+入库记录删除 |
| | | /// </summary> |
| | | /// <param name="dt">提交数据</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteInStorageRecord")] |
| | | [HttpPost] |
| | | public JsonResult DeleteInStorageRecord(DataTable dt) |
| | | { |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | //var token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyY29kZSI6Ijk5OTkiLCJ1c2VybmFtZSI6Iuezu-e7n-euoeeQhuWRmCIsInN0b3JnX2NvZGUiOiIiLCJzdG9yZ19uYW1lIjoiIiwiaXNfc3lzdGVtX2FkbWluIjoiWSIsInJvbGVfY29kZSI6IiIsInJvbGVfZGF0YXBlcm1pc3Npb25zIjoiIiwidXNlcnR5cGUiOiJQQyIsInJlZGlza2V5IjoiTmV3TUVTTG9naW5Vc2VySURQQzk5OTkiLCJtZXNTZXR0aW5nIjoie1wicm91dGVcIjp0cnVlLFwiaXNPcmRlclwiOnRydWUsXCJkZXZpY2VcIjp0cnVlLFwidGVjaFwiOnRydWUsXCJ3b3JrT3JkZXJcIjp0cnVlLFwiZXZlcnlcIjpmYWxzZSxcImxhc3RcIjpmYWxzZX0iLCJ0aW1lb3V0IjoiMjAyNC0xMC0yNFQxMjozNTo1MC4zNDI1NzE2KzA4OjAwIn0.Nbc-1sXd4QLLsnj8wH9XC7iWEmP0wDG82gwLxIh94e4"; |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | mes = ReportManagerBLL.DeleteInStorageRecord(dt, us); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | /// <summary> |
| | | /// 生产入库信息查询 |
| | | /// </summary> |
| | | /// <param name="deptno">部门编码(T8使用)</param> |
| | | /// <param name="saleordercode">销售单号</param> |
| | | /// <param name="wkshopcode">车间编码</param> |
| | | /// <param name="erpordercode">订单编号</param> |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "ProductInHouseOrderSearch")] |
| | | [HttpGet] |
| | | public JsonResult ProductInHouseOrderSearch(string saleordercode, string wkshopcode, string erpordercode = null, string mesordercode = null, string partcode = null, string partname = null, string partspec = null) |
| | | public JsonResult ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode = null, string mesordercode = null, string partcode = null, string partname = null, string partspec = null) |
| | | { |
| | | mes = WorkOrderBLL.ProductInHouseOrderSearch(saleordercode,wkshopcode, erpordercode, mesordercode, partcode, partname, partspec); |
| | | mes = WorkOrderBLL.ProductInHouseOrderSearch(deptno,saleordercode, wkshopcode, erpordercode, mesordercode, partcode, partname, partspec); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产入库获取部门信息] |
| | | #region[通易T8生产入库获取部门信息] |
| | | /// <summary> |
| | | /// 生产入库获取部门信息 |
| | | /// 通易T8生产入库获取部门信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "DeptSelectData")] |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using VueWebCoreApi.DLL.DAL; |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region[入库记录] |
| | | public static ToMessage StorageRecordSearch(string hbillno, string sono, string mono, string wocode, string partcode,string partname, string stockcode, string respondopendate, string respondclosedate, int startNum, int endNum, string prop, string order) |
| | | #region[T8入库记录表头] |
| | | public static ToMessage StorageRecordMainSearch(string hbillno, string username, string hbdateopendate, string hbdateclosedate, string userdateopendate, string userdateclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | return ReportManagerDAL.StorageRecordSearch(hbillno,sono,mono,wocode,partcode, partname,stockcode, respondopendate,respondclosedate,startNum,endNum,prop,order); |
| | | return ReportManagerDAL.StorageRecordMainSearch(hbillno, username, hbdateopendate, hbdateclosedate, userdateopendate, userdateclosedate, startNum, endNum, prop, order); |
| | | } |
| | | #endregion |
| | | |
| | | #region[T8入库记录表体] |
| | | public static ToMessage StorageRecordSubSearch(string hbillno) |
| | | { |
| | | return ReportManagerDAL.StorageRecordSubSearch(hbillno); |
| | | } |
| | | #endregion |
| | | |
| | | #region[T8入库记录删除] |
| | | public static ToMessage StorageRecordDelete(DataTable dt, User us) |
| | | { |
| | | return ReportManagerDAL.StorageRecordDelete(dt, us); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | return ReportManagerDAL.StorageRecordExcelSearch(hbillno, sono, mono, wocode, partcode, partname, stockcode, respondopendate, respondclosedate); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[T+入库记录表头] |
| | | public static ToMessage InStorageRecordMainSearch(string hbillno, string username, string hbdateopendate, string hbdateclosedate, string userdateopendate, string userdateclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | return ReportManagerDAL.InStorageRecordMainSearch(hbillno, username, hbdateopendate, hbdateclosedate, userdateopendate, userdateclosedate, startNum, endNum, prop, order); |
| | | } |
| | | #endregion |
| | | |
| | | #region[T+入库记录表体] |
| | | public static ToMessage InStorageRecordSubSearch(string hbillno) |
| | | { |
| | | return ReportManagerDAL.InStorageRecordSubSearch(hbillno); |
| | | } |
| | | #endregion |
| | | |
| | | #region[T+入库记录删除] |
| | | public static ToMessage DeleteInStorageRecord(DataTable dt, User us) |
| | | { |
| | | return ReportManagerDAL.DeleteInStorageRecord(dt, us); |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | #endregion |
| | | |
| | | #region[生产入库信息查询] |
| | | public static ToMessage ProductInHouseOrderSearch(string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec) |
| | | public static ToMessage ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec) |
| | | { |
| | | return WorkOrderDAL.ProductInHouseOrderSearch(saleordercode,wkshopcode, erpordercode, mesordercode, partcode, partname, partspec); |
| | | return WorkOrderDAL.ProductInHouseOrderSearch(deptno,saleordercode, wkshopcode, erpordercode, mesordercode, partcode, partname, partspec); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产入库获取部门信息] |
| | | #region[通易T8生产入库获取部门信息] |
| | | public static ToMessage DeptSelectData() |
| | | { |
| | | return WorkOrderDAL.DeptSelectData(); |
| | |
| | | public class KanBanManagerentDAL |
| | | { |
| | | public static ToMessage mes = new ToMessage(); //定义全局返回信息对象 |
| | | public static string ErpPath = AppSetting.GetAppSetting("ErpPath"); //获取ERP配置 |
| | | |
| | | |
| | | #region[车间看板,上生产信息] |
| | | public static ToMessage WorkShopProduceTopData(string wkshopcode) |
| | |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] //存储过程名 |
| | | sql = @"select * from h_v_JLKanBan_WorkshopTop where wkshp_code in @wkshoplist"; |
| | | dynamicParams.Add("@wkshoplist", wkshoplist); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | |
| | | try |
| | | { |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftTop"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWorkShopCompreLeftTop"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WorkShopCompreLeftTop"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data = DapperHelper.selecttable(sql); |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftCenter"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWorkShopCompreLeftCenter"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WorkShopCompreLeftCenter"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data1 = DapperHelper.selecttable(sql); |
| | | for (int i = 0; i < wkshoplist.Length; i++) |
| | | { |
| | |
| | | Dictionary<object, object> dir = new Dictionary<object, object>(); |
| | | try |
| | | { |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreRightTop"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWorkShopCompreRightTop"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WorkShopCompreRightTop"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data = DapperHelper.selecttable(sql); |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreRightCenter"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWorkShopCompreRightCenter"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WorkShopCompreRightCenter"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | var data1 = DapperHelper.selecttable(sql); |
| | | dir.Add("RightTop", data); |
| | | dir.Add("RightBottom", data1); |
| | |
| | | Dictionary<object, object> dir = new Dictionary<object, object>(); |
| | | try |
| | | { |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftBottom_Top"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWorkShopCompreLeftBottom_Top"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WorkShopCompreLeftBottom_Top"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data = DapperHelper.selecttable(sql); |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftBottom_Bottom"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWorkShopCompreLeftBottom_Bottom"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WorkShopCompreLeftBottom_Bottom"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data1 = DapperHelper.selecttable(sql); |
| | | dir.Add("BottomLeftTop", data); |
| | | dir.Add("BottomLeftBottom", data1); |
| | |
| | | Dictionary<object, object> dir = new Dictionary<object, object>(); |
| | | try |
| | | { |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreRightBottom"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWorkShopCompreRightBottom"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WorkShopCompreRightBottom"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data = DapperHelper.selecttable(sql); |
| | | dir.Add("Y", data.Rows[0]["BaseQuantity"].ToString()); |
| | | dir.Add("B", data.Rows[1]["BaseQuantity"].ToString()); |
| | |
| | | try |
| | | { |
| | | //获取仓库生产加工单待入库列表 |
| | | sql = @"select * from h_v_JLKanBan_WareHouseTopLeft order by voucherdate"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWareHouseTopLeft order by voucherdate"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WareHouseTopLeft order by voucherdate"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | |
| | | try |
| | | { |
| | | //获取仓库生产加工单待入库列表 |
| | | sql = @"select * from h_v_JLKanBan_WareHouseTopBottom order by voucherdate"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWareHouseTopBottom order by voucherdate"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WareHouseTopBottom order by voucherdate"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | |
| | | string sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_JLKanBan_WareHouseRightTop"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWareHouseRightTop"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WareHouseRightTop"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | |
| | | string sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_JLKanBan_WareHouseRightBottom"; |
| | | switch (ErpPath) |
| | | { |
| | | case "T+": |
| | | sql = @"select * from h_v_JLKanBan_TCloundWareHouseRightBottom"; |
| | | break; |
| | | case "T8": |
| | | sql = @"select * from h_v_JLKanBan_T8WareHouseRightBottom"; |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | |
| | | public static string strProcName = ""; //定义全局sql变量 |
| | | public static List<SqlParameter> listStr = new List<SqlParameter>(); //定义全局参数集合 |
| | | public static SqlParameter[] parameters; //定义全局SqlParameter参数数组 |
| | | public static string ErpPath = AppSetting.GetAppSetting("ErpPath"); //获取ERP配置 |
| | | |
| | | |
| | | #region[生产进度报表] |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region[入库记录] |
| | | public static ToMessage StorageRecordSearch(string hbillno, string sono, string mono, string wocode, string partcode, string partname, string stockcode, string respondopendate, string respondclosedate, int startNum, int endNum, string prop, string order) |
| | | #region[T8入库记录表头] |
| | | public static ToMessage StorageRecordMainSearch(string hbillno, string username, string hbdateopendate, string hbdateclosedate, string userdateopendate, string userdateclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | |
| | | { |
| | | if (hbillno != "" && hbillno != null) |
| | | { |
| | | search += "and AA.hbillno like '%'+@hbillno+'%' "; |
| | | search += "and hbillno like '%'+@hbillno+'%' "; |
| | | dynamicParams.Add("@hbillno", hbillno); |
| | | } |
| | | if (sono != "" && sono != null) |
| | | if (username != "" && username != null) |
| | | { |
| | | search += "and AA.salecode like '%'+@sono+'%' "; |
| | | dynamicParams.Add("@sono", sono); |
| | | search += "and create_user like '%'+@username+'%' "; |
| | | dynamicParams.Add("@username", username); |
| | | } |
| | | if (mono != "" && mono != null) |
| | | if (hbdateopendate != "" && hbdateopendate != null) |
| | | { |
| | | search += "and AA.mo_no like '%'+@mono+'%' "; |
| | | dynamicParams.Add("@mono", mono); |
| | | search += "and hbdate between @hbdateopendate and @hbdateclosedate "; |
| | | dynamicParams.Add("@hbdateopendate", hbdateopendate + " 00:00:00"); |
| | | dynamicParams.Add("@hbdateclosedate", hbdateclosedate + " 23:59:59"); |
| | | } |
| | | if (wocode != "" && wocode != null) |
| | | if (userdateopendate != "" && userdateopendate != null) |
| | | { |
| | | search += "and AA.wocode like '%'+@wocode+'%' "; |
| | | dynamicParams.Add("@wocode", wocode); |
| | | } |
| | | if (partcode != "" && partcode != null) |
| | | { |
| | | search += "and AA.partcode like '%'+@partcode+'%' "; |
| | | dynamicParams.Add("@partcode", partcode); |
| | | } |
| | | if (partname != "" && partname != null) |
| | | { |
| | | search += "and AA.partname like '%'+@partname+'%' "; |
| | | dynamicParams.Add("@partname", partname); |
| | | } |
| | | if (stockcode != "" && stockcode != null) |
| | | { |
| | | search += "and AA.stockcode=@stockcode "; |
| | | dynamicParams.Add("@stockcode", stockcode); |
| | | } |
| | | if (respondopendate != "" && respondopendate != null) |
| | | { |
| | | search += "and AA.hbdate between @respondopendate and @respondclosedate "; |
| | | dynamicParams.Add("@respondopendate", respondopendate + " 00:00:00"); |
| | | dynamicParams.Add("@respondclosedate", respondclosedate + " 23:59:59"); |
| | | search += "and create_date between @userdateopendate and @userdateclosedate "; |
| | | dynamicParams.Add("@userdateopendate", userdateopendate + " 00:00:00"); |
| | | dynamicParams.Add("@userdateclosedate", userdateclosedate + " 23:59:59"); |
| | | } |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select * from( |
| | | select A.hbillno,A.hbdate,B.salecode,B.mo_no,B.wocode,B.partcode,P.partname,P.partspec,M.wkshp_code,T.torg_name as wkshp_name,B.stockcode,S.name as stockname, |
| | | B.qty,B.inbarcode,R.step_code,E.stepname,R.style,A.create_user,A.create_date |
| | | from TK_WMS_Inwh_Main A |
| | | inner join TK_WMS_Inwh_Sub B on A.hbillno=B.hbillno |
| | | inner join TK_Wrk_Record R on B.inbarcode=R.inbarcode |
| | | left join TK_Wrk_Man M on B.wocode=M.wo_code |
| | | left join TMateriel_Info P on B.partcode=P.partcode |
| | | left join TSecStck S on B.stockcode=S.code |
| | | left join TStep E on R.step_code=E.stepcode |
| | | left join TOrganization T on M.wkshp_code=T.torg_code |
| | | union all |
| | | select A.hbillno,A.hbdate,B.salecode,B.mo_no,B.wocode,B.partcode,P.partname,P.partspec,M.wkshp_code,T.torg_name as wkshp_name,B.stockcode,S.name as stockname, |
| | | B.qty,B.inbarcode,O.step_code,E.stepname,O.style,A.create_user,A.create_date |
| | | from TK_WMS_Inwh_Main A |
| | | inner join TK_WMS_Inwh_Sub B on A.hbillno=B.hbillno |
| | | inner join TK_Wrk_OutRecord O on B.inbarcode=O.inbarcode |
| | | left join TK_Wrk_Man M on B.wocode=M.wo_code |
| | | left join TMateriel_Info P on B.partcode=P.partcode |
| | | left join TSecStck S on B.stockcode=S.code |
| | | left join TStep E on O.step_code=E.stepcode |
| | | left join TOrganization T on M.wkshp_code=T.torg_code |
| | | ) as AA where 1=1 " + search; |
| | | var sql = @"select (case when docu_typecode='WI' then '产成品入库' end) as hbilltype,hbillno,hbdate,create_user,create_date |
| | | from TK_WMS_Inwh_Main where 1=1 " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[T8入库记录表体] |
| | | public static ToMessage StorageRecordSubSearch(string hbillno) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | dynamicParams.Add("@hbillno", hbillno); |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select * from( |
| | | select S.hbillno,S.rownumber,S.inbarcode,S.mo_id,S.mo_no,E.sbid,S.wocode,R.step_code,T.stepname,E.materiel_id,S.partcode,M.partname,M.partspec, |
| | | E.unitid,S.unitcode,E.unitname,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,K.name as stockname, |
| | | S.qty,S.salecode,S.style |
| | | from TK_WMS_Inwh_Sub S |
| | | left join TKimp_Ewo E on S.mo_no=E.wo and S.mo_id=E.woid and S.partcode=E.materiel_code |
| | | left join TK_Wrk_Record R on S.inbarcode=R.inbarcode |
| | | left join TStep T on R.step_code=T.stepcode |
| | | left join TMateriel_Info M on S.partcode=M.partcode |
| | | left join TSecStck K on COALESCE(M.idwarehouse, E.stck_code)=K.code |
| | | where S.style='B' and S.hbillno=@hbillno |
| | | union all |
| | | select S.hbillno,S.rownumber,S.inbarcode,S.mo_id,S.mo_no,E.sbid,S.wocode,O.step_code,T.stepname,E.materiel_id,S.partcode,M.partname,M.partspec, |
| | | E.unitid,S.unitcode,E.unitname,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,K.name as stockname, |
| | | S.qty,S.salecode,S.style |
| | | from TK_WMS_Inwh_Sub S |
| | | left join TKimp_Ewo E on S.mo_no=E.wo and S.mo_id=E.woid and S.partcode=E.materiel_code |
| | | left join TK_Wrk_OutRecord O on S.inbarcode=O.inbarcode |
| | | left join TStep T on O.step_code=T.stepcode |
| | | left join TMateriel_Info M on S.partcode=M.partcode |
| | | left join TSecStck K on COALESCE(M.idwarehouse, E.stck_code)=K.code |
| | | where S.style='S' and S.hbillno=@hbillno |
| | | ) as AA" + search; |
| | | DataTable data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[T8入库记录删除] |
| | | public static ToMessage StorageRecordDelete(DataTable dt, User us) |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | //存储过程名 |
| | | sql = @"h_p_IFCLD_T8DeleteInProductOrder"; |
| | | dynamicParams.Add("@RecordSub", dbType: DbType.Object, value: dt); |
| | | // 添加输出参数 |
| | | dynamicParams.Add("@StatusCode", dbType: DbType.Int32, direction: ParameterDirection.Output); |
| | | dynamicParams.Add("@Message", dbType: DbType.String, size: 255, direction: ParameterDirection.Output); |
| | | bool a = DapperHelper.IsProcedure(sql, dynamicParams); |
| | | // 获取输出参数的值 |
| | | var statusCode = dynamicParams.Get<int>("@StatusCode"); |
| | | var message = dynamicParams.Get<string>("@Message"); |
| | | if (a) |
| | | { |
| | | mes.code = statusCode.ToString(); |
| | | mes.count = 0; |
| | | mes.message = message; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = statusCode.ToString(); |
| | | mes.count = 0; |
| | | mes.message = message; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | try |
| | | { |
| | | // 使用LINQ的lambda表达式根据hbillno分组并统计每个组的条数 |
| | | var groupedRecords = json.GroupBy(r => r.hbillno).Select(g => new{hbillno = g.Key,count = g.Count()}).ToList(); |
| | | var groupedRecords = json.GroupBy(r => r.hbillno).Select(g => new { hbillno = g.Key, count = g.Count() }).ToList(); |
| | | for (int i = 0; i < groupedRecords.Count; i++) |
| | | { |
| | | //查询入库单子表的数据条数 |
| | |
| | | inbarcode = json[i].inbarcode.ToString() |
| | | } |
| | | }); |
| | | if (json[i].style == "B") |
| | | if (json[i].style == "B") |
| | | { |
| | | //自制报工记录表入库数量 |
| | | sql = @"update TK_Wrk_Record set inhouseqty=inhouseqty-@qty where inbarcode=@inbarcode"; |
| | | //删除报工记录主表 |
| | | //sql = @"delete from TK_Wrk_Record where id=@repoid and inbarcode=@inbarcode"; |
| | | //list.Add(new |
| | | //{ |
| | | // str = sql, |
| | | // parm = new |
| | | // { |
| | | // repoid = json[i].repoid.ToString(), |
| | | // inbarcode = json[i].inbarcode.ToString() |
| | | // } |
| | | //}); |
| | | //修改自制报工入库数量 |
| | | sql = @"update TK_Wrk_Record set inhouseqty=inhouseqty-@qty where inbarcode=@inbarcode and id=@repoid"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | repoid = json[i].repoid.ToString(), |
| | | qty = json[i].qty.ToString(), |
| | | inbarcode = json[i].inbarcode.ToString() |
| | | } |
| | |
| | | } |
| | | if (json[i].style == "S") |
| | | { |
| | | //外协收料记录表入库数量 |
| | | //删除外协收料记录主表 |
| | | //sql = @"delete from TK_Wrk_OutRecord where id=@repoid and inbarcode=@inbarcode"; |
| | | //list.Add(new |
| | | //{ |
| | | // str = sql, |
| | | // parm = new |
| | | // { |
| | | // repoid = json[i].repoid.ToString(), |
| | | // inbarcode = json[i].inbarcode.ToString() |
| | | // } |
| | | //}); |
| | | //修改外协收料记录表入库数量 |
| | | sql = @"update TK_Wrk_OutRecord set inhouseqty=inhouseqty-@qty where inbarcode=@inbarcode"; |
| | | list.Add(new |
| | | { |
| | |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "删除", "删除了入库单:"+ string.Join(",", json.Select(r => $"{r.hbillno},{r.inbarcode}")), us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "删除", "删除了入库单:" + string.Join(",", json.Select(r => $"{r.hbillno},{r.inbarcode}")), us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "入库单删除成功!"; |
| | |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[T+入库记录表头] |
| | | public static ToMessage InStorageRecordMainSearch(string hbillno, string username, string hbdateopendate, string hbdateclosedate, string userdateopendate, string userdateclosedate, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (hbillno != "" && hbillno != null) |
| | | { |
| | | search += "and hbillno like '%'+@hbillno+'%' "; |
| | | dynamicParams.Add("@hbillno", hbillno); |
| | | } |
| | | if (username != "" && username != null) |
| | | { |
| | | search += "and create_user like '%'+@username+'%' "; |
| | | dynamicParams.Add("@username", username); |
| | | } |
| | | if (hbdateopendate != "" && hbdateopendate != null) |
| | | { |
| | | search += "and hbdate between @hbdateopendate and @hbdateclosedate "; |
| | | dynamicParams.Add("@hbdateopendate", hbdateopendate + " 00:00:00"); |
| | | dynamicParams.Add("@hbdateclosedate", hbdateclosedate + " 23:59:59"); |
| | | } |
| | | if (userdateopendate != "" && userdateopendate != null) |
| | | { |
| | | search += "and create_date between @userdateopendate and @userdateclosedate "; |
| | | dynamicParams.Add("@userdateopendate", userdateopendate + " 00:00:00"); |
| | | dynamicParams.Add("@userdateclosedate", userdateclosedate + " 23:59:59"); |
| | | } |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select (case when docu_typecode='69' then '产成品入库' end) as hbilltype,hbillno,hbdate,create_user,create_date |
| | | from TK_WMS_Inwh_Main where 1=1 " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[T+入库记录表体] |
| | | public static ToMessage InStorageRecordSubSearch(string hbillno) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | dynamicParams.Add("@hbillno", hbillno); |
| | | //search = search.Substring(3);//截取索引2后面的字符 |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | var sql = @"select * from( |
| | | select S.hbillno,S.rownumber,S.inbarcode,S.mo_id,S.mo_no,E.sbid,S.wocode,R.step_code,T.stepname,E.materiel_id,S.partcode,M.partname,M.partspec, |
| | | E.unitid,S.unitcode,E.unitname,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,K.name as stockname, |
| | | S.qty,S.salecode,S.style |
| | | from TK_WMS_Inwh_Sub S |
| | | left join TKimp_Ewo E on S.mo_no=E.wo and S.mo_id=E.woid and S.partcode=E.materiel_code |
| | | left join TK_Wrk_Record R on S.inbarcode=R.inbarcode |
| | | left join TStep T on R.step_code=T.stepcode |
| | | left join TMateriel_Info M on S.partcode=M.partcode |
| | | left join TSecStck K on COALESCE(M.idwarehouse, E.stck_code)=K.code |
| | | where S.style='B' and S.hbillno=@hbillno |
| | | union all |
| | | select S.hbillno,S.rownumber,S.inbarcode,S.mo_id,S.mo_no,E.sbid,S.wocode,O.step_code,T.stepname,E.materiel_id,S.partcode,M.partname,M.partspec, |
| | | E.unitid,S.unitcode,E.unitname,COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,K.name as stockname, |
| | | S.qty,S.salecode,S.style |
| | | from TK_WMS_Inwh_Sub S |
| | | left join TKimp_Ewo E on S.mo_no=E.wo and S.mo_id=E.woid and S.partcode=E.materiel_code |
| | | left join TK_Wrk_OutRecord O on S.inbarcode=O.inbarcode |
| | | left join TStep T on O.step_code=T.stepcode |
| | | left join TMateriel_Info M on S.partcode=M.partcode |
| | | left join TSecStck K on COALESCE(M.idwarehouse, E.stck_code)=K.code |
| | | where S.style='S' and S.hbillno=@hbillno |
| | | ) as AA" + search; |
| | | DataTable data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[T+入库记录删除] |
| | | public static ToMessage DeleteInStorageRecord(DataTable dt, User us) |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | //存储过程名 |
| | | sql = @"h_p_IFCLD_TCloudDeleteInProductOrder"; |
| | | dynamicParams.Add("@RecordSub", dbType: DbType.Object, value: dt); |
| | | // 添加输出参数 |
| | | dynamicParams.Add("@StatusCode", dbType: DbType.Int32, direction: ParameterDirection.Output); |
| | | dynamicParams.Add("@Message", dbType: DbType.String, size: 255, direction: ParameterDirection.Output); |
| | | bool a = DapperHelper.IsProcedure(sql, dynamicParams); |
| | | // 获取输出参数的值 |
| | | var statusCode = dynamicParams.Get<int>("@StatusCode"); |
| | | var message = dynamicParams.Get<string>("@Message"); |
| | | if (a) |
| | | { |
| | | mes.code = statusCode.ToString(); |
| | | mes.count = 0; |
| | | mes.message = message; |
| | | mes.data = null; |
| | | } |
| | | else |
| | | { |
| | | mes.code = statusCode.ToString(); |
| | | mes.count = 0; |
| | | mes.message = message; |
| | | mes.data = null; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | //根据条件查询工单工序任务(自制工序) |
| | | sql = @"select A.id,A.status,B.dept_code,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | sql = @"select A.id,A.status,E.dept_id,B.dept_code,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,E.materiel_id,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | S.stepcode,S.stepname,S.descr,A.plan_qty,A.good_qty,A.ng_qty,A.laborbad_qty,A.materielbad_qty,B.lm_date, |
| | | E.sbid,B.m_po,E.saleOrderCode,E.saleOrderDetailId,E.unitid,E.unitcode,E.unitname,K.code as stockcode,k.name as stockname |
| | | E.sbid,E.woid as mpoid,B.m_po,E.saleOrderid,E.saleOrderCode,E.saleOrderDetailId,E.unitid,E.unitcode,E.unitname, |
| | | COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,k.name as stockname,E.voucherdate |
| | | from TK_Wrk_Step A |
| | | left join TK_Wrk_Man B on A.wo_code=B.wo_code |
| | | left join TMateriel_Info M on B.materiel_code=M.partcode |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TOrganization T on B.wkshp_code=T.torg_code |
| | | left join TKimp_Ewo E on B.sourceid=E.id and B.m_po=E.wo |
| | | left join TSecStck K on M.idwarehouse=K.code |
| | | left join TSecStck K on COALESCE(M.idwarehouse, E.stck_code)=K.code |
| | | where A.status in('ALLO','START') and S.flwtype='Z' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | |
| | | dynamicParams.Add("@partspec", partspec); |
| | | } |
| | | //根据条件查询工单工序任务(自制工序) |
| | | sql = @"select A.id,A.status,B.dept_code,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | sql = @"select A.id,A.status,E.dept_id,B.dept_code,B.wkshp_code,T.torg_name as wkshp_name,A.wo_code,E.materiel_id,M.partcode,M.partname,M.partspec,A.seq,A.isbott,A.isend, |
| | | S.stepcode,S.stepname,S.descr,A.plan_qty,A.good_qty,A.ng_qty, |
| | | (select isnull(sum(fqty),0) as fqty from TK_Wrk_OutRecord where wo_code=A.wo_code and step_code=A.step_code and style='F') as fqty, |
| | | A.laborbad_qty,A.materielbad_qty,A.plan_startdate,A.plan_enddate,B.lm_date, |
| | | E.sbid,B.m_po,E.saleOrderCode,E.saleOrderDetailId,E.unitid,E.unitcode,E.unitname,K.code as stockcode,k.name as stockname |
| | | E.sbid,E.woid as mpoid,B.m_po,E.saleOrderid,E.saleOrderCode,E.saleOrderDetailId,E.unitid,E.unitcode,E.unitname, |
| | | COALESCE(K.noid, E.stck_id) as stockid,COALESCE(K.code, E.stck_code) as stockcode,k.name as stockname,E.voucherdate |
| | | from TK_Wrk_Step A |
| | | left join TK_Wrk_Man B on A.wo_code=B.wo_code |
| | | left join TMateriel_Info M on B.materiel_code=M.partcode |
| | | left join TStep S on A.step_code=S.stepcode |
| | | left join TOrganization T on B.wkshp_code=T.torg_code |
| | | left join TKimp_Ewo E on B.sourceid=E.id and B.m_po=E.wo |
| | | left join TSecStck K on M.idwarehouse=K.code |
| | | left join TSecStck K on COALESCE(M.idwarehouse, E.stck_code)=K.code |
| | | where A.status in('ALLO','START') and S.flwtype='W' " + search; |
| | | var data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | | mes.code = "200"; |
| | |
| | | ngqty = groupedItems.Sum(item => Convert.ToDecimal(item.badqty)); |
| | | } |
| | | list.Clear(); |
| | | //判断物料是否为空 |
| | | if (partcode == "" || partcode == null) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "当前报工,物料编码为空,请检查存货信息!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //判断是否有开工记录(无新增) |
| | | sql = @"select * from TK_Wrk_Record where wo_code=@wo_code and step_code=@step_code and style='S' and eqp_code=@eqpcode"; |
| | | dynamicParams.Add("@wo_code", mesordercode); |
| | |
| | | } |
| | | |
| | | list.Clear(); |
| | | //判断物料是否为空 |
| | | if (partcode == "" || partcode == null) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "当前报工,物料编码为空,请检查存货信息!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //判断是否有收料记录(有:(同工单+工序+外协供方修改) 无:新增) |
| | | sql = @"select * from TK_Wrk_OutRecord where wo_code=@wo_code and step_code=@step_code and wx_code=@wx_code and style='S'"; |
| | | dynamicParams.Add("@wo_code", mesordercode); |
| | |
| | | FROM TUser U |
| | | WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.report_person + ',') > 0 |
| | | FOR XML PATH('')), 1, 1, '') AS username, |
| | | B.report_date,B.report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,'' as wx_code,'' as wx_name |
| | | B.report_date,B.report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,A.inhouseqty,'' as wx_code,'' as wx_name |
| | | from TK_Wrk_Record A |
| | | inner join TK_Wrk_RecordSub B on A.id=B.m_id |
| | | left join TK_Wrk_Man M on A.wo_code=M.wo_code |
| | |
| | | FROM TUser U |
| | | WHERE CHARINDEX(',' + U.usercode + ',', ',' + B.in_person + ',') > 0 |
| | | FOR XML PATH('')), 1, 1, '') AS username, |
| | | B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,A.wx_code,C.name as wx_name |
| | | B.in_time as report_date,B.sqty as report_qty,B.ng_qty,B.laborbad_qty,B.materielbad_qty,A.inhouseqty,A.wx_code,C.name as wx_name |
| | | from TK_Wrk_OutRecord A |
| | | inner join TK_Wrk_OutRecordSub B on A.id = B.m_id |
| | | left join TK_Wrk_Man M on A.wo_code = M.wo_code |
| | |
| | | #endregion |
| | | |
| | | #region[生产入库信息查询] |
| | | public static ToMessage ProductInHouseOrderSearch(string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec) |
| | | public static ToMessage ProductInHouseOrderSearch(string deptno, string saleordercode, string wkshopcode, string erpordercode, string mesordercode, string partcode, string partname, string partspec) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string search = ""; |
| | | try |
| | | { |
| | | if (deptno != "" && deptno != null) |
| | | { |
| | | search += "and AA.dept_code=@deptno "; |
| | | dynamicParams.Add("@deptno", deptno); |
| | | } |
| | | if (saleordercode != "" && saleordercode != null) |
| | | { |
| | | search += "and AA.saleOrderCode like '%'+@saleordercode+'%' "; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[生产入库获取部门信息] |
| | | #region[通易T8生产入库获取部门信息] |
| | | public static ToMessage DeptSelectData() |
| | | { |
| | | var sql = ""; |
| | |
| | | string search = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_TFDepent"; |
| | | sql = @"select * from h_v_T8Depent"; |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | |
| | | /// 报工类型(B:自制/S外协) |
| | | /// </summary> |
| | | public string style { get; set; } |
| | | /// <summary> |
| | | /// 末道工序报工记录id |
| | | /// </summary> |
| | | public string repoid { get; set; } |
| | | } |
| | | } |