| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Net.Http; |
| | | using System.Threading.Tasks; |
| | | using VueWebCoreApi.DLL.BLL; |
| | | using VueWebCoreApi.Tools; |
| | |
| | | ToMessage mes = new ToMessage(); |
| | | RedisCommon redis = new RedisCommon(); |
| | | |
| | | #region[车间看板,上生产信息] |
| | | #region[圣沣仓库看板左上,采购待入库] |
| | | /// <summary> |
| | | /// 车间看板,上生产信息 |
| | | /// 圣沣仓库看板左上,采购待入库 |
| | | /// </summary> |
| | | /// <param name="wkshopcode">车间编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "ProcureOutsourcLeftTop")] |
| | | [HttpGet] |
| | | public JsonResult ProcureOutsourcLeftTop() |
| | | { |
| | | mes = KanBanManagerentBLL.ProcureOutsourcLeftTop(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣仓库看板左下,销售待发货] |
| | | /// <summary> |
| | | /// 圣沣仓库看板左下,销售待发货 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "ProductConsignmentLeftBottom")] |
| | | [HttpGet] |
| | | public JsonResult ProductConsignmentLeftBottom() |
| | | { |
| | | mes = KanBanManagerentBLL.ProductConsignmentLeftBottom(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣仓库看板右上,近一周采购待入库物料排行TOP5] |
| | | /// <summary> |
| | | /// 圣沣仓库看板右上,近一周采购待入库物料排行TOP5 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "ProcureOutsourcRightTop")] |
| | | [HttpGet] |
| | | public JsonResult ProcureOutsourcRightTop() |
| | | { |
| | | mes = KanBanManagerentBLL.ProcureOutsourcRightTop(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣仓库看板右下,近一周销售待发货产品排行TOP5] |
| | | /// <summary> |
| | | /// 圣沣仓库看板右下,近一周销售待发货产品排行TOP5 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "ProductionStockedInRightBottom")] |
| | | [HttpGet] |
| | | public JsonResult ProductionStockedInRightBottom() |
| | | { |
| | | mes = KanBanManagerentBLL.ProductionStockedInRightBottom(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region[圣沣生产看板左上,生产待入库] |
| | | /// <summary> |
| | | /// 圣沣生产看板左上,生产待入库 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "ProductionStockedInLeftTop")] |
| | | [HttpGet] |
| | | public JsonResult ProductionStockedInLeftTop() |
| | | { |
| | | mes = KanBanManagerentBLL.ProductionStockedInLeftTop(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣生产看板右上,近一周生产待入库产品排行TOP10] |
| | | /// <summary> |
| | | /// 圣沣生产看板右上,近一周生产待入库产品排行TOP10 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "ProductionStockedInRightTop")] |
| | | [HttpGet] |
| | | public JsonResult ProductionStockedInRightTop() |
| | | { |
| | | mes = KanBanManagerentBLL.ProductionStockedInRightTop(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[圣沣车间看板,上生产信息] |
| | | /// <summary> |
| | | /// 圣沣车间看板,上生产信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "WorkShopProduceTopData")] |
| | | [HttpGet] |
| | | public JsonResult WorkShopProduceTopData(string wkshopcode) |
| | | public JsonResult WorkShopProduceTopData() |
| | | { |
| | | mes = KanBanManagerentBLL.WorkShopProduceTopData(wkshopcode); |
| | | mes = KanBanManagerentBLL.WorkShopProduceTopData(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间看板,下左近一周不良趋势] |
| | | #region[圣沣车间看板,下左近一周不良趋势] |
| | | /// <summary> |
| | | /// 车间看板,下左近一周不良趋势 |
| | | /// 圣沣车间看板,下左近一周不良趋势 |
| | | /// </summary> |
| | | /// <param name="wkshopcode">车间编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "WorkShopProduceBottomLeftData")] |
| | | [HttpGet] |
| | | public JsonResult WorkShopProduceBottomLeftData(string wkshopcode) |
| | | public JsonResult WorkShopProduceBottomLeftData() |
| | | { |
| | | mes = KanBanManagerentBLL.WorkShopProduceBottomLeftData(wkshopcode); |
| | | mes = KanBanManagerentBLL.WorkShopProduceBottomLeftData(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间看板,下右近一月不良统计] |
| | | #region[圣沣车间看板,下右近一月不良统计] |
| | | /// <summary> |
| | | /// 车间看板,下右近一月不良统计 |
| | | /// 圣沣车间看板,下右近一月不良统计 |
| | | /// </summary> |
| | | /// <param name="wkshopcode">车间编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "WorkShopProduceBottomRightData")] |
| | | [HttpGet] |
| | | public JsonResult WorkShopProduceBottomRightData(string wkshopcode) |
| | | public JsonResult WorkShopProduceBottomRightData() |
| | | { |
| | | mes = KanBanManagerentBLL.WorkShopProduceBottomRightData(wkshopcode); |
| | | mes = KanBanManagerentBLL.WorkShopProduceBottomRightData(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[车间综合看板,左上生产订单] |
| | | |
| | | #region[圣沣车间综合看板,左上生产订单] |
| | | /// <summary> |
| | | /// 车间综合看板,左上生产订单 |
| | | /// 圣沣车间综合看板,左上生产订单 |
| | | /// </summary> |
| | | /// <param name="wkshopcode">车间编码字符串集</param> |
| | | /// <returns></returns> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间综合看板,右上销售订单] |
| | | #region[圣沣车间综合看板,右上销售订单] |
| | | /// <summary> |
| | | /// 车间综合看板,右上销售订单 |
| | | /// 圣沣车间综合看板,右上销售订单 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "WorkShopCompreRightTop")] |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间综合看板,右下库存] |
| | | #region[圣沣车间综合看板,左下采购订单] |
| | | /// <summary> |
| | | /// 车间综合看板,右下库存 |
| | | /// 圣沣车间综合看板,左下采购订单 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "WorkShopCompreLeftBottom")] |
| | | [HttpGet] |
| | | public JsonResult WorkShopCompreLeftBottom() |
| | | { |
| | | mes = KanBanManagerentBLL.WorkShopCompreLeftBottom(); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣车间综合看板,右下库存] |
| | | /// <summary> |
| | | /// 圣沣车间综合看板,右下库存 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route(template: "WorkShopCompreRightBottom")] |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[计量单位组新增/编辑] |
| | | /// <summary> |
| | | /// 计量单位组新增/编辑 |
| | | /// </summary> |
| | | /// <param name="OperType">操作类型(Add/Update)</param> |
| | | /// <param name="json">提交数据对象</param> |
| | | /// <returns></returns> |
| | | [Route(template: "AddUpdateTUnitGroup")] |
| | | [HttpPost] |
| | | public JsonResult AddUpdateTUnitGroup(string OperType, List<ObjectDataCont> json) |
| | | { |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | mes = ProductModelBLL.AddUpdateTUnitGroup(OperType, json, us); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | #region[计量单位组删除] |
| | | /// <summary> |
| | | /// 计量单位组删除 |
| | | /// </summary> |
| | | /// <param name="tunitgroupcode">单位组编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteTUnitGroup")] |
| | | [HttpPost] |
| | | public JsonResult DeleteTUnitGroup(string tunitgroupcode) |
| | | { |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | mes = ProductModelBLL.DeleteTUnitGroup(tunitgroupcode, us); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[计量单位信息列表] |
| | | /// <summary> |
| | | /// 计量单位信息列表 |
| | | /// </summary> |
| | | /// <param name="tunittype">单计量(S) 多计量(M)</param> |
| | | /// <param name="tunitgroupcode">计量单位组编码</param> |
| | | /// <param name="page">页码</param> |
| | | /// <param name="rows">每页显示条数</param> |
| | |
| | | /// <returns></returns> |
| | | [Route(template: "TUnitData")] |
| | | [HttpGet] |
| | | public JsonResult TUnitData(string tunittype,string tunitgroupcode, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | public JsonResult TUnitData(string tunitgroupcode, int page = 0, int rows = 0, string prop = null, string order = null) |
| | | { |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | int startNum = rows * (page - 1) + 1; //起始记录rowNum |
| | | int endNum = rows * page; //结束记录 rowNum |
| | | mes = ProductModelBLL.TUnitData(tunittype,tunitgroupcode, startNum, endNum, prop, order); |
| | | mes = ProductModelBLL.TUnitData(tunitgroupcode, startNum, endNum, prop, order); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// 计量单位新增、编辑保存 |
| | | /// </summary> |
| | | /// <param name="data_sources">数据来源:ERP/MES</param> |
| | | /// <param name="tunittype">单计量(S) 多计量(M)</param> |
| | | /// <param name="tunitgroupcode">计量单位组编码</param> |
| | | /// <param name="OperType">操作类型:Add/Update</param> |
| | | /// <param name="listjson">提交数据</param> |
| | | /// <returns></returns> |
| | | [Route(template: "AddUpdateTUnit")] |
| | | [HttpPost] |
| | | public JsonResult AddUpdateTUnit(string data_sources, string tunittype,string tunitgroupcode,string OperType, List<Unit> listjson) |
| | | public JsonResult AddUpdateTUnit(string data_sources,string tunitgroupcode,string OperType, List<Unit> listjson) |
| | | { |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | var menucode = HttpContext.Request.Headers["Menucode"].ToString(); //菜单编码 |
| | | mes = ProductModelBLL.AddUpdateTUnit(menucode, data_sources,tunittype, tunitgroupcode, OperType, listjson, us); |
| | | mes = ProductModelBLL.AddUpdateTUnit(menucode, data_sources, tunitgroupcode, OperType, listjson, us); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | |
| | | /// 计量单位删除 |
| | | /// </summary> |
| | | /// <param name="data_sources">数据来源:ERP/MES</param> |
| | | /// <param name="tunittype">单计量(S) 多计量(M)</param> |
| | | /// <param name="tunitgroupcode">计量单位组编码</param> |
| | | /// <param name="tunitcode">计量单位编码</param> |
| | | /// <returns></returns> |
| | | [Route(template: "DeleteTUnit")] |
| | | [HttpPost] |
| | | public JsonResult DeleteTUnit(string data_sources, string tunittype, string tunitgroupcode, string tunitcode) |
| | | public JsonResult DeleteTUnit(string data_sources, string tunitgroupcode, string tunitcode) |
| | | { |
| | | var token = HttpContext.Request.Headers["Token"].ToString(); |
| | | User us = JwtTools.Denocode(token.ToString()); |
| | | mes = ProductModelBLL.DeleteTUnit(data_sources, tunittype, tunitgroupcode, tunitcode, us); |
| | | mes = ProductModelBLL.DeleteTUnit(data_sources, tunitgroupcode, tunitcode, us); |
| | | return Json(mes); |
| | | } |
| | | #endregion |
| | |
| | | { |
| | | public class KanBanManagerentBLL |
| | | { |
| | | #region[车间看板,上生产信息] |
| | | public static ToMessage WorkShopProduceTopData(string wkshopcode) |
| | | #region[圣沣仓库看板左上,采购待入库] |
| | | public static ToMessage ProcureOutsourcLeftTop() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopProduceTopData(wkshopcode); |
| | | return KanBanManagerentDAL.ProcureOutsourcLeftTop(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间看板,下左近一周不良趋势] |
| | | public static ToMessage WorkShopProduceBottomLeftData(string wkshopcode) |
| | | #region[圣沣仓库看板左下,销售待发货] |
| | | public static ToMessage ProductConsignmentLeftBottom() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopProduceBottomLeftData(wkshopcode); |
| | | return KanBanManagerentDAL.ProductConsignmentLeftBottom(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间看板,下右近一月不良统计] |
| | | public static ToMessage WorkShopProduceBottomRightData(string wkshopcode) |
| | | #region[圣沣仓库看板右上,近一周采购待入库物料排行TOP5] |
| | | public static ToMessage ProcureOutsourcRightTop() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopProduceBottomRightData(wkshopcode); |
| | | return KanBanManagerentDAL.ProcureOutsourcRightTop(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣仓库看板右下,近一周销售待发货产品排行TOP5] |
| | | public static ToMessage ProductionStockedInRightBottom() |
| | | { |
| | | return KanBanManagerentDAL.ProductionStockedInRightBottom(); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[车间综合看板,左上生产订单] |
| | | #region[圣沣生产看板左上,生产待入库] |
| | | public static ToMessage ProductionStockedInLeftTop() |
| | | { |
| | | return KanBanManagerentDAL.ProductionStockedInLeftTop(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣生产看板右上,近一周生产待入库产品排行TOP10] |
| | | public static ToMessage ProductionStockedInRightTop() |
| | | { |
| | | return KanBanManagerentDAL.ProductionStockedInRightTop(); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | #region[圣沣车间看板,上生产信息] |
| | | public static ToMessage WorkShopProduceTopData() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopProduceTopData(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣车间看板,下左近一周不良趋势] |
| | | public static ToMessage WorkShopProduceBottomLeftData() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopProduceBottomLeftData(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣车间看板,下右近一月不良统计] |
| | | public static ToMessage WorkShopProduceBottomRightData() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopProduceBottomRightData(); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[圣沣车间综合看板,左上生产订单] |
| | | public static ToMessage WorkShopCompreLeftTop(string wkshopcode) |
| | | { |
| | | return KanBanManagerentDAL.WorkShopCompreLeftTop(wkshopcode); |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间综合看板,右上销售订单] |
| | | #region[圣沣车间综合看板,右上销售订单] |
| | | public static ToMessage WorkShopCompreRightTop() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopCompreRightTop(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间综合看板,右下库存] |
| | | #region[圣沣车间综合看板,左下采购订单] |
| | | public static ToMessage WorkShopCompreLeftBottom() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopCompreLeftBottom(); |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣车间综合看板,右下库存] |
| | | public static ToMessage WorkShopCompreRightBottom() |
| | | { |
| | | return KanBanManagerentDAL.WorkShopCompreRightBottom(); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[计量单位信息列表] |
| | | public static ToMessage TUnitData(string tunittype, string tunitgroupcode, int startNum, int endNum, string prop, string order) |
| | | #region[计量单位组新增/编辑] |
| | | public static ToMessage AddUpdateTUnitGroup(string OperType, List<ObjectDataCont> json, User us) |
| | | { |
| | | return ProductModelDAL.TUnitData(tunittype, tunitgroupcode, startNum, endNum, prop, order); |
| | | return ProductModelDAL.AddUpdateTUnitGroup(OperType, json, us); |
| | | } |
| | | #endregion |
| | | |
| | | #region[计量单位组删除] |
| | | public static ToMessage DeleteTUnitGroup(string tunitgroupcode, User us) |
| | | { |
| | | return ProductModelDAL.DeleteTUnitGroup(tunitgroupcode, us); |
| | | } |
| | | #endregion |
| | | |
| | | #region[计量单位信息列表] |
| | | public static ToMessage TUnitData(string tunitgroupcode, int startNum, int endNum, string prop, string order) |
| | | { |
| | | return ProductModelDAL.TUnitData(tunitgroupcode, startNum, endNum, prop, order); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region[计量单位新增、编辑保存] |
| | | public static ToMessage AddUpdateTUnit(string menucode,string data_sources, string tunittype, string tunitgroupcode, string OperType, List<Unit> listjson, User us) |
| | | public static ToMessage AddUpdateTUnit(string menucode,string data_sources, string tunitgroupcode, string OperType, List<Unit> listjson, User us) |
| | | { |
| | | return ProductModelDAL.AddUpdateTUnit(menucode, data_sources,tunittype, tunitgroupcode, OperType, listjson, us); |
| | | return ProductModelDAL.AddUpdateTUnit(menucode, data_sources, tunitgroupcode, OperType, listjson, us); |
| | | } |
| | | #endregion |
| | | |
| | | #region[计量单位删除] |
| | | public static ToMessage DeleteTUnit(string data_sources, string tunittype, string tunitgroupcode, string tunitcode, User us) |
| | | public static ToMessage DeleteTUnit(string data_sources, string tunitgroupcode, string tunitcode, User us) |
| | | { |
| | | return ProductModelDAL.DeleteTUnit(data_sources, tunittype, tunitgroupcode, tunitcode, us); |
| | | return ProductModelDAL.DeleteTUnit(data_sources, tunitgroupcode, tunitcode, us); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | { |
| | | public static ToMessage mes = new ToMessage(); //定义全局返回信息对象 |
| | | |
| | | #region[车间看板,上生产信息] |
| | | public static ToMessage WorkShopProduceTopData(string wkshopcode) |
| | | #region[圣沣仓库看板左上,采购待入库] |
| | | public static ToMessage ProcureOutsourcLeftTop() |
| | | { |
| | | string sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | var sql = ""; |
| | | try |
| | | { |
| | | 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); |
| | | sql = @"select * from h_v_SFKanBan_ProcureNotReceived"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间看板,下左近一周不良趋势] |
| | | public static ToMessage WorkShopProduceBottomLeftData(string wkshopcode) |
| | | #region[圣沣仓库看板左下,产品代发货] |
| | | public static ToMessage ProductConsignmentLeftBottom() |
| | | { |
| | | var sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_SFKanBan_ProductionNotDeliver"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣仓库看板右上,近一周采购待入库物料排行TOP5] |
| | | public static ToMessage ProcureOutsourcRightTop() |
| | | { |
| | | var sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_SFKanBan_ProcureNotReceivedSumTop"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣仓库看板右下,近一周销售待发货产品排行TOP5] |
| | | public static ToMessage ProductionStockedInRightBottom() |
| | | { |
| | | var sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_SFKanBan_ProductionNotDeliverSumTop"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[圣沣生产看板左上,生产待入库] |
| | | public static ToMessage ProductionStockedInLeftTop() |
| | | { |
| | | var sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_SFKanBan_ProductionNotReceived"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣生产看板右上,近一周生产待入库产品排行TOP10] |
| | | public static ToMessage ProductionStockedInRightTop() |
| | | { |
| | | var sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_SFKanBan_ProductionNotReceivedSumTop"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region[圣沣车间看板,上生产信息] |
| | | public static ToMessage WorkShopProduceTopData() |
| | | { |
| | | string sql = ""; |
| | | try |
| | | { |
| | | sql = @"select * from h_v_SFKanBan_WorkshopTop"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣车间看板,下左近一周不良趋势] |
| | | public static ToMessage WorkShopProduceBottomLeftData() |
| | | { |
| | | string sql = ""; |
| | | Dictionary<object, object> dir = new Dictionary<object, object>(); |
| | | try |
| | | { |
| | | //存储过程名(当前时间往前一周) |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | sql = @"h_p_JLKanBan_WorkshopBottomLeft"; |
| | | for (int i = 0; i < wkshoplist.Length; i++) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | dynamicParams.Add("@wkshop_code", wkshoplist[i].ToString()); |
| | | var dt = DapperHelper.selectProcedure(sql, dynamicParams); |
| | | dir.Add(wkshoplist[i].ToString(), dt); |
| | | } |
| | | |
| | | sql = @"h_p_SFKanBan_WorkshopBottomLeft"; |
| | | var data = DapperHelper.lissql(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = dir; |
| | | mes.data = data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间看板,下右近一月不良统计] |
| | | public static ToMessage WorkShopProduceBottomRightData(string wkshopcode) |
| | | #region[圣沣车间看板,下右近一月不良统计] |
| | | public static ToMessage WorkShopProduceBottomRightData() |
| | | { |
| | | string sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | string[] wkshoplist = Array.ConvertAll<string, string>(wkshopcode.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), s => s.ToString()); //string分割转string[] |
| | | sql = @"select * from h_v_JLKanBan_WorkshopBottomRight where wkshp_code in @wkshoplist"; |
| | | dynamicParams.Add("@wkshoplist", wkshoplist); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | sql = @"select * from h_v_SFKanBan_WorkshopBottomRight"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = data; |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region[车间综合看板,左上生产订单] |
| | | #region[圣沣车间综合看板,左上生产订单] |
| | | public static ToMessage WorkShopCompreLeftTop(string wkshopcode) |
| | | { |
| | | var sql = ""; |
| | | var dynamicParams = new DynamicParameters(); |
| | | Dictionary<object, object> dir = new Dictionary<object, object>(); |
| | | Dictionary<object, object> dir0 = new Dictionary<object, object>(); |
| | | Dictionary<object, object> dir1 = new Dictionary<object, object>(); |
| | | 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"; |
| | | sql = @"select * from h_v_SFKanBan_WorkShopCompreLeftTop"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreLeftCenter"; |
| | | sql = @"select * from h_v_SFKanBan_WorkShopCompreLeftCenter"; |
| | | var data1 = DapperHelper.selecttable(sql); |
| | | for (int i = 0; i < wkshoplist.Length; i++) |
| | | { |
| | | var top0 = data.AsEnumerable() |
| | | .Where(row => row.Field<string>("wkshp_code") == wkshoplist[i].ToString()) // 添加查询条件 |
| | | .Select(group => new |
| | | { |
| | | wkshp_code = group.Field<string>("wkshp_code"), |
| | | plan_qty = group.Field<decimal>("plan_qty"), |
| | | good_qty = group.Field<decimal>("good_qty") |
| | | }).DefaultIfEmpty(new { wkshp_code = wkshoplist[i].ToString(), plan_qty = 0m, good_qty = 0m })//为空时指定默认值 |
| | | .ToList(); |
| | | dir0.Add(wkshoplist[i].ToString(), top0); |
| | | |
| | | var top1 = data1.AsEnumerable() |
| | | .Where(row => row.Field<string>("wkshp_code") == wkshoplist[i].ToString()) // 添加查询条件 |
| | | .Select(group => new |
| | | { |
| | | wkshp_code = group.Field<string>("wkshp_code"), |
| | | plan_qty = group.Field<decimal>("plan_qty"), |
| | | quantity = group.Field<decimal>("quantity") |
| | | }).DefaultIfEmpty(new { wkshp_code = wkshoplist[i].ToString(), plan_qty = 0m, quantity = 0m })//为空时指定默认值 |
| | | .ToList(); |
| | | dir1.Add(wkshoplist[i].ToString(), top1); |
| | | } |
| | | dir.Add("LeftTop", dir0); |
| | | dir.Add("LeftBottom", dir1); |
| | | dir.Add("LeftTop", data); |
| | | dir.Add("LeftBottom", data1); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = dir; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间综合看板,右上销售订单] |
| | | #region[圣沣车间综合看板,右上销售订单] |
| | | public static ToMessage WorkShopCompreRightTop() |
| | | { |
| | | var sql = ""; |
| | | Dictionary<object, object> dir = new Dictionary<object, object>(); |
| | | try |
| | | { |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreRightTop"; |
| | | sql = @"select * from h_v_SFKanBan_WorkShopCompreRightTop"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreRightCenter"; |
| | | sql = @"select * from h_v_SFKanBan_WorkShopCompreRightCenter"; |
| | | var data1 = DapperHelper.selecttable(sql); |
| | | dir.Add("RightTop", data); |
| | | dir.Add("RightBottom", data1); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[车间综合看板,右下库存] |
| | | #region[圣沣车间综合看板,左下采购订单] |
| | | public static ToMessage WorkShopCompreLeftBottom() |
| | | { |
| | | var sql = ""; |
| | | Dictionary<object, object> dir = new Dictionary<object, object>(); |
| | | try |
| | | { |
| | | sql = @"select * from h_v_SFKanBan_WorkShopCompreLeftBottom_Top"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | sql = @"select * from h_v_SFKanBan_WorkShopCompreLeftBottom_Bottom"; |
| | | var data1 = DapperHelper.selecttable(sql); |
| | | dir.Add("BottomLeftTop", data); |
| | | dir.Add("BottomLeftBottom", data1); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | | mes.data = dir; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = e.Message; |
| | | mes.data = null; |
| | | } |
| | | return mes; |
| | | } |
| | | #endregion |
| | | |
| | | #region[圣沣车间综合看板,右下库存] |
| | | public static ToMessage WorkShopCompreRightBottom() |
| | | { |
| | | var sql = ""; |
| | | Dictionary<object, object> dir = new Dictionary<object, object>(); |
| | | try |
| | | { |
| | | sql = @"select * from h_v_JLKanBan_WorkShopCompreRightBottom"; |
| | | sql = @"select * from h_v_SFKanBan_WorkShopCompreRightBottom"; |
| | | var data = DapperHelper.selecttable(sql); |
| | | dir.Add("Y", data.Rows[0]["BaseQuantity"].ToString()); |
| | | dir.Add("B", data.Rows[1]["BaseQuantity"].ToString()); |
| | |
| | | try |
| | | { |
| | | //获取计量单位组信息 |
| | | sql = @"select code,name,'1' as isGroup,data_sources from TUnitGroup "; |
| | | sql = @"select code,name,'1' as isGroup,igrouptype,data_sources from TUnitGroup "; |
| | | var data = DapperHelper.selecttable(sql); |
| | | mes.code = "200"; |
| | | mes.message = "查询成功!"; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region[计量单位组新增/编辑] |
| | | public static ToMessage AddUpdateTUnitGroup(string OperType, List<ObjectDataCont> json, User us) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | | if (OperType == "Add") |
| | | { |
| | | //判断计量单位组编码是否重复 |
| | | sql = @"select * from TUnitGroup where code=@tunitgroupcode"; |
| | | dynamicParams.Add("@tunitgroupcode", json[0].code); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位组编码已存在,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //判断计量单位组名称是否重复 |
| | | sql = @"select * from TUnitGroup where name=@tunitgroupname"; |
| | | dynamicParams.Add("@tunitgroupname", json[0].name); |
| | | var data1 = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data1.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位组名称已存在,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //循环写入计量单位组表 |
| | | for (int i = 0; i < json.Count; i++) |
| | | { |
| | | sql = @"insert into TUnitGroup(code,name,igrouptype,lm_user,lm_date,data_sources) values(@code,@name,@username,@createdate,@data_sources)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = json[i].code, |
| | | name = json[i].name, |
| | | igrouptype = json[i].group, |
| | | username = us.usercode, |
| | | createdate = DateTime.Now.ToString(), |
| | | data_sources = "MES" |
| | | } |
| | | }); |
| | | } |
| | | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "新增", "新增了计量单位组:" + string.Join(",", json.Select(m => m.code)), 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; |
| | | } |
| | | } |
| | | if (OperType == "Update") |
| | | { |
| | | //判断设备名称是否重复 |
| | | sql = @"select * from TUnitGroup where code<>@tunitgroupcode and name=@tunitgroupname"; |
| | | dynamicParams.Add("@tunitgroupcode", json[0].code); |
| | | dynamicParams.Add("@tunitgroupname", json[0].name); |
| | | var data1 = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data1.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位组名称已存在,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | for (int i = 0; i < json.Count; i++) |
| | | { |
| | | sql = @"update TUnitGroup set name=@tunitgroupname,lm_user=@lm_user,lm_date=@lm_date |
| | | where code=@tunitgroupcode"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | tunitgroupcode = json[i].code, |
| | | tunitgroupname = json[i].name, |
| | | lm_user = us.usercode, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | } |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "修改", "修改了计量单位组:" + string.Join(",", json.Select(m => m.code)), 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 |
| | | |
| | | #region[计量单位组删除] |
| | | public static ToMessage DeleteTUnitGroup(string tunitgroupcode, User us) |
| | | { |
| | | var sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | list.Clear(); |
| | | sql = @"delete TUnitGroup where code=@code"; |
| | | list.Add(new { str = sql, parm = new { code = tunitgroupcode } }); |
| | | sql = @"delete TUnit where idunitgroup=@tunitgroupcode"; |
| | | list.Add(new { str = sql, parm = new { tunitgroupcode = tunitgroupcode } }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "删除", "删除了计量单位组:" + tunitgroupcode, 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 |
| | | |
| | | |
| | | |
| | | #region[计量单位信息列表] |
| | | public static ToMessage TUnitData(string tunittype, string tunitgroupcode, int startNum, int endNum, string prop, string order) |
| | | public static ToMessage TUnitData(string tunitgroupcode, int startNum, int endNum, string prop, string order) |
| | | { |
| | | var dynamicParams = new DynamicParameters(); |
| | | string sql = ""; |
| | | string search = "", sql = ""; |
| | | IEnumerable<object> data; |
| | | try |
| | | { |
| | | if (tunittype == "" || tunittype == null) |
| | | if (tunitgroupcode != "" && tunitgroupcode != null) |
| | | { |
| | | sql = @"select AA.code,AA.name,U.username as lm_user,AA.lm_date,AA.isGroup,AA.idunitgroup,AA.data_sources |
| | | from( |
| | | select code,name,lm_user,lm_date,isGroup,idunitgroup,data_sources |
| | | from TUnit T |
| | | where T.isGroup='0' |
| | | union all |
| | | select code,name,lm_user,lm_date,'1' as isGroup,code as idunitgroup,data_sources |
| | | from TUnitGroup |
| | | ) as AA |
| | | left join TUser U on AA.lm_user=U.usercode "; |
| | | } |
| | | if (tunittype == "S") //单计量 |
| | | { |
| | | sql = @"select T.code,T.name,U.username as lm_user,T.lm_date,T.isGroup,T.idunitgroup,T.data_sources |
| | | from TUnit T |
| | | left join TUser U on T.lm_user=U.usercode |
| | | where T.isSingleUnit='1' and T.isGroup='0'"; |
| | | } |
| | | if (tunittype == "M" && (tunitgroupcode == "" || tunitgroupcode == null)) //多计量,且多计量组编码为空 |
| | | { |
| | | sql = @"select T.code,T.name,U.usercode as lm_user,T.lm_date,'1' as isGroup,T.code as idunitgroup,T.data_sources |
| | | from TUnitGroup T |
| | | left join TUser U on T.lm_user=U.usercode"; |
| | | } |
| | | if (tunittype == "M" && (tunitgroupcode != "" && tunitgroupcode != null)) //多计量,且多计量组编码不为空 |
| | | { |
| | | sql = @"select T.code,T.name,T.isMainUnit,T.changeRate,T.rateDescription,U.username as lm_user,T.lm_date,T.isGroup,T.idunitgroup,T.data_sources |
| | | from TUnit T |
| | | left join TUser U on T.lm_user=U.usercode |
| | | where T.isSingleUnit='0' and T.isGroup='1' and T.idunitgroup=@tunitgroupcode"; |
| | | search += "and T.idunitgroup=@tunitgroupcode "; |
| | | dynamicParams.Add("@tunitgroupcode", tunitgroupcode); |
| | | } |
| | | sql = @"select T.code,T.name,T.isMainUnit,T.changeRate,T.rateDescription,U.username as lm_user,T.lm_date,T.isGroup,T.idunitgroup,T.data_sources |
| | | from TUnit T |
| | | left join TUser U on T.lm_user=U.usercode |
| | | where 1=1 " + search; |
| | | // --------------查询指定数据-------------- |
| | | var total = 0; //总条数 |
| | | data = DapperHelper.GetPageList<object>(sql, dynamicParams, prop, order, startNum, endNum, out total); |
| | |
| | | mes.message = "查询成功!"; |
| | | mes.count = total; |
| | | mes.data = data.ToList(); |
| | | LogHelper.OperateLog("999", "查询", "查询了计量单位", "PC"); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | #endregion |
| | | |
| | | #region[计量单位新增、编辑保存] |
| | | public static ToMessage AddUpdateTUnit(string menucode, string data_sources, string tunittype, string tunitgroupcode, string OperType, List<Unit> listjson, User us) |
| | | public static ToMessage AddUpdateTUnit(string menucode, string data_sources, string tunitgroupcode, string OperType, List<Unit> listjson, User us) |
| | | { |
| | | string sql = ""; |
| | | List<object> list = new List<object>(); |
| | |
| | | { |
| | | return mes; |
| | | } |
| | | if (tunittype == "S") //单计量 |
| | | |
| | | sql = @"select * from TUnit where isGroup='0' and name=@name"; |
| | | dynamicParams.Add("@name", listjson[0].unitname); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | sql = @"select * from TUnit where isGroup='0' and name=@name"; |
| | | dynamicParams.Add("@name", listjson[0].unitname); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位的名称不能重复,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | } |
| | | if (tunittype == "M")//多计量 |
| | | { |
| | | sql = @"select * from TUnitGroup where name=@name"; |
| | | dynamicParams.Add("@name", listjson[0].unitname); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位组的名称不能重复,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //写入计量单位组 |
| | | sql = @"insert into TUnitGroup(code,name,lm_user,lm_date,data_sources) |
| | | values(@code,@name,@lm_user,@lm_date,@data_sources)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = ((List<string>)mes.data)[0].ToString(), |
| | | name = listjson[0].unitname, |
| | | data_sources = data_sources, |
| | | lm_user = us.usercode, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位的名称不能重复,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | for (int i = 0; i < listjson[0].children.Count; i++) |
| | | { |
| | |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = tunittype == "S" ? ((List<string>)mes.data)[0].ToString() : listjson[0].children[i].unitcode, |
| | | code = listjson[0].children[i].unitcode, |
| | | name = listjson[0].children[i].unitname, |
| | | isMainUnit = listjson[0].children[i].isMainUnit, |
| | | changeRate = listjson[0].children[i].changeRate, |
| | |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "新增", "新增了计量单位:"+ tunittype == "S" ? ((List<string>)mes.data)[0].ToString() : string.Join(",", listjson[0].children.Select(m => m.unitcode)), us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "新增", "新增了计量单位:" + string.Join(",", listjson[0].children.Select(m => m.unitcode)), us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "新增操作成功!"; |
| | |
| | | } |
| | | if (OperType == "Update") |
| | | { |
| | | if (tunittype == "S") //单计量 |
| | | sql = @"select * from TUnit where isGroup='0' and code<>@code and name=@name"; |
| | | dynamicParams.Add("@code", listjson[0].unitcode); |
| | | dynamicParams.Add("@name", listjson[0].unitname); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | sql = @"select * from TUnit where isGroup='0' and code<>@code and name=@name"; |
| | | dynamicParams.Add("@code", listjson[0].unitcode); |
| | | dynamicParams.Add("@name", listjson[0].unitname); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位的名称不能重复,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | |
| | | //更新计量单位(单计量) |
| | | sql = @"update TUnit set name=@name,lm_user=@lm_user,lm_date=@lm_date |
| | | where code=@code and isSingleUnit=@isSingleUnit and isGroup=@isGroup"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = listjson[0].children[0].unitcode, |
| | | name = listjson[0].children[0].unitname, |
| | | isSingleUnit = listjson[0].children[0].isSingleUnit, |
| | | isGroup = listjson[0].children[0].isGroup, |
| | | lm_user = us.usercode, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | |
| | | } |
| | | if (tunittype == "M")//多计量 |
| | | { |
| | | sql = @"select * from TUnitGroup where code<>@code and name=@name"; |
| | | dynamicParams.Add("@code", listjson[0].unitcode); |
| | | dynamicParams.Add("@name", listjson[0].unitname); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位组的名称不能重复,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //修改计量单位组 |
| | | sql = @"update TUnitGroup set name=@name,lm_user=@lm_user,lm_date=@lm_date where code=@code"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = listjson[0].unitcode, |
| | | name = listjson[0].unitname, |
| | | lm_user = us.usercode, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | //删除计量单位组明细(从计量单位表删除) |
| | | sql = @"delete TUnit where idunitgroup=@idunitgroup"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | idunitgroup = tunitgroupcode |
| | | } |
| | | }); |
| | | for (int i = 0; i < listjson[0].children.Count; i++) |
| | | { |
| | | //写入计量单位 |
| | | sql = @"insert into TUnit(code,name,isMainUnit,changeRate,rateDescription,isSingleUnit,disabled,idunitgroup,isGroup,data_sources,lm_user,lm_date) |
| | | values(@code,@name,@isMainUnit,@changeRate,@rateDescription,@isSingleUnit,@disabled,@idunitgroup,@isGroup,@data_sources,@lm_user,@lm_date)"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = listjson[0].children[i].unitcode, |
| | | name = listjson[0].children[i].unitname, |
| | | isMainUnit = listjson[0].children[i].isMainUnit, |
| | | changeRate = listjson[0].children[i].changeRate, |
| | | rateDescription = listjson[0].children[i].rateDescription, |
| | | isSingleUnit = listjson[0].children[i].isSingleUnit, |
| | | disabled = listjson[0].children[i].disabled, |
| | | idunitgroup = listjson[0].children[i].idunitgroup, |
| | | isGroup = listjson[0].children[i].isGroup, |
| | | data_sources = listjson[0].children[i].data_sources, |
| | | lm_user = us.usercode, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | } |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "计量单位的名称不能重复,请重新输入!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | |
| | | //更新计量单位(单计量) |
| | | sql = @"update TUnit set name=@name,lm_user=@lm_user,lm_date=@lm_date,isMainUnit=@isMainUnit,changeRate=@changeRate,rateDescription=@rateDescription,isSingleUnit=@isSingleUnit,disabled=@disabled,idunitgroup=@idunitgroup,isGroup=@isGroup |
| | | where code=@code"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = listjson[0].children[0].unitcode, |
| | | name = listjson[0].children[0].unitname, |
| | | isMainUnit = listjson[0].children[0].isMainUnit, |
| | | changeRate = listjson[0].children[0].changeRate, |
| | | rateDescription = listjson[0].children[0].rateDescription, |
| | | isSingleUnit = listjson[0].children[0].isSingleUnit, |
| | | disabled = listjson[0].children[0].disabled, |
| | | idunitgroup = ((List<string>)mes.data)[0].ToString(), |
| | | isGroup = listjson[0].children[0].isGroup, |
| | | lm_user = us.usercode, |
| | | lm_date = DateTime.Now.ToString() |
| | | } |
| | | }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "修改", "修改了计量单位:" + tunittype == "S" ? ((List<string>)mes.data)[0].ToString() : string.Join(",", listjson[0].children.Select(m => m.unitcode)), us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "修改", "修改了计量单位:" + string.Join(",", listjson[0].children.Select(m => m.unitcode)), us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "修改操作成功!"; |
| | |
| | | #endregion |
| | | |
| | | #region[计量单位删除] |
| | | public static ToMessage DeleteTUnit(string data_sources, string tunittype, string tunitgroupcode, string tunitcode, User us) |
| | | public static ToMessage DeleteTUnit(string data_sources, string tunitgroupcode, string tunitcode, User us) |
| | | { |
| | | string sql = ""; |
| | | List<object> list = new List<object>(); |
| | | var dynamicParams = new DynamicParameters(); |
| | | try |
| | | { |
| | | if (tunittype == "S") //单计量 |
| | | |
| | | sql = @"select * from TMateriel_Info where isSingleUnit='1' and idunit=@idunit"; |
| | | dynamicParams.Add("@idunit", tunitcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | sql = @"select * from TMateriel_Info where isSingleUnit='1' and idunit=@idunit"; |
| | | dynamicParams.Add("@idunit", tunitcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "单计量单位已被使用,不允许删除!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //删除计量单位 |
| | | sql = @"delete TUnit where isSingleUnit='1' and isGroup='0' and code=@code and data_sources=@data_sources"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = tunitcode, |
| | | data_sources = data_sources |
| | | } |
| | | }); |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "单计量单位已被使用,不允许删除!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | if (tunittype == "M" && (tunitgroupcode != "" || tunitgroupcode != null) && (tunitcode == "" || tunitcode == null)) //多计量,且多计量组编码不为空,明细编码为空 |
| | | //删除计量单位 |
| | | sql = @"delete TUnit where idunitgroup=@idunitgroup and code=@code and data_sources=@data_sources"; |
| | | list.Add(new |
| | | { |
| | | sql = @"select * from TUnit T |
| | | inner join TMateriel_Info M on T.idunitgroup=M.idunitgroup and T.code=M.idunit |
| | | where T.isSingleUnit='0' and T.idunitgroup=@idunitgroup"; |
| | | dynamicParams.Add("@idunitgroup", tunitgroupcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "多计量单位组中有计量单位被使用,不允许删除!"; |
| | | mes.data = null; |
| | | return mes; |
| | | idunitgroup= tunitgroupcode, |
| | | code = tunitcode, |
| | | data_sources = data_sources |
| | | } |
| | | //删除多计量单位组 |
| | | sql = @"delete TUnitGroup where code=@code and data_sources=@data_sources"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | code = tunitgroupcode, |
| | | data_sources = data_sources |
| | | } |
| | | }); |
| | | //删除多计量单位组下所有计量单位 |
| | | sql = @"delete TUnit where isSingleUnit='0' and isGroup='1' and idunitgroup=@idunitgroup and data_sources=@data_sources"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | idunitgroup = tunitgroupcode, |
| | | data_sources = data_sources |
| | | } |
| | | }); |
| | | } |
| | | if (tunittype == "M" && (tunitgroupcode != "" && tunitgroupcode != null) && (tunitcode != "" || tunitcode != null)) //多计量,且多计量组编码不为空,明细编码不为空 |
| | | { |
| | | sql = @"select * from TUnit T |
| | | inner join TMateriel_Info M on T.idunitgroup=M.idunitgroup and T.code=M.idunit |
| | | where T.isSingleUnit='0' and M.isSingleUnit='0' and T.idunitgroup=@idunitgroup and T.code=@idunit"; |
| | | dynamicParams.Add("@idunitgroup", tunitgroupcode); |
| | | dynamicParams.Add("@idunit", tunitcode); |
| | | var data = DapperHelper.selectdata(sql, dynamicParams); |
| | | if (data.Rows.Count > 0) |
| | | { |
| | | mes.code = "300"; |
| | | mes.count = 0; |
| | | mes.message = "多计量单位已被使用,不允许删除!"; |
| | | mes.data = null; |
| | | return mes; |
| | | } |
| | | //删除多计量单位组下指定计量单位 |
| | | sql = @"delete TUnit where isSingleUnit='0' and isGroup='1' and idunitgroup=@idunitgroup and code=@code and data_sources=@data_sources"; |
| | | list.Add(new |
| | | { |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | idunitgroup = tunitgroupcode, |
| | | code = tunitcode, |
| | | data_sources = data_sources |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "新增", "新增了计量单位:" + tunittype == "S" ? tunitcode : tunittype == "M"&& (tunitgroupcode != "" || tunitgroupcode != null) && (tunitcode == "" || tunitcode == null)? tunitgroupcode: tunitgroupcode+"-->"+tunitcode, us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "删除", "删除了计量单位:"+tunitcode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "删除操作成功!"; |
| | |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "新增", "新增了存货分类:"+ inventoryclasscode, us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "新增", "新增了存货分类:" + inventoryclasscode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "新增操作成功!"; |
| | |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "修改", "修改了存货分类:"+ inventoryclasscode, us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "修改", "修改了存货分类:" + inventoryclasscode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "修改操作成功!"; |
| | |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "删除", "删除了存货分类"+classcode, us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "删除", "删除了存货分类" + classcode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "删除操作成功!"; |
| | |
| | | str = sql, |
| | | parm = new |
| | | { |
| | | partcode=partcode, |
| | | partname=partname, |
| | | partspec=partspec, |
| | | idunit=unittypcode=="1"?unitcode:unitsubcode, |
| | | idunitgroup = unittypcode == "0"?"1":"0", |
| | | isSingleUnit= unittypcode, |
| | | idSubUnitByReport=idSubUnitByReport, |
| | | idUnitByStock= idUnitByStock, |
| | | idUnitByPurchase= idUnitByPurchase, |
| | | idUnitBySale= idUnitBySale, |
| | | idunitbymanufacture= idunitbymanufacture, |
| | | idinventoryclass= inventoryclasscode, |
| | | isPurchase= isPurchase, |
| | | isSale= isSale, |
| | | isMadeSelf= isMadeSelf, |
| | | isMaterial= isMaterial, |
| | | isMadeRequest= isMadeRequest, |
| | | idwarehouse= idwarehouse, |
| | | status= status, |
| | | partcode = partcode, |
| | | partname = partname, |
| | | partspec = partspec, |
| | | idunit = unittypcode == "1" ? unitcode : unitsubcode, |
| | | idunitgroup = unittypcode == "0" ? "1" : "0", |
| | | isSingleUnit = unittypcode, |
| | | idSubUnitByReport = idSubUnitByReport, |
| | | idUnitByStock = idUnitByStock, |
| | | idUnitByPurchase = idUnitByPurchase, |
| | | idUnitBySale = idUnitBySale, |
| | | idunitbymanufacture = idunitbymanufacture, |
| | | idinventoryclass = inventoryclasscode, |
| | | isPurchase = isPurchase, |
| | | isSale = isSale, |
| | | isMadeSelf = isMadeSelf, |
| | | isMaterial = isMaterial, |
| | | isMadeRequest = isMadeRequest, |
| | | idwarehouse = idwarehouse, |
| | | status = status, |
| | | lm_user = us.usercode, |
| | | lm_date = DateTime.Now.ToString(), |
| | | data_sources = data_sources |
| | |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "新增", "新增了存货档案:"+ partcode, us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "新增", "新增了存货档案:" + partcode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "新增操作成功!"; |
| | |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "修改", "修改了存货档案:"+ partcode, us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "修改", "修改了存货档案:" + partcode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "修改操作成功!"; |
| | |
| | | parm = new |
| | | { |
| | | partcode = partcode, |
| | | data_sources= data_sources |
| | | data_sources = data_sources |
| | | } |
| | | }); |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, "删除", "删除了存货档案:"+partcode, us.usertype); |
| | | LogHelper.DbOperateLog(us.usercode, "删除", "删除了存货档案:" + partcode, us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "删除操作成功!"; |
| | |
| | | bool aa = DapperHelper.DoTransaction(list); |
| | | if (aa) |
| | | { |
| | | //写入操作记录表 |
| | | LogHelper.DbOperateLog(us.usercode, ""+ checktypename + "检验", "工单:"+ wocode + "对应工序:" + stepcode+"", us.usertype); |
| | | mes.code = "200"; |
| | | mes.count = 0; |
| | | mes.message = "操作成功!"; |
| | |
| | | { |
| | | c.SwaggerDoc(version, new OpenApiInfo() |
| | | { |
| | | Title = $"新凯迪MesApi文档:{version}", |
| | | Title = $"新凯迪-圣沣客户MesApi文档:{version}", |
| | | Version = version, |
| | | Description = $"Panda.Sewerage : {version} ", |
| | | }); |
| | |
| | | new ScoreReport("2","班组管理"), |
| | | new ScoreReport("3","人员管理"), |
| | | new ScoreReport("4","角色管理"), |
| | | new ScoreReport("5","往来单位"), |
| | | //new ScoreReport("5","往来单位"), |
| | | new ScoreReport("6","仓库设置"), |
| | | new ScoreReport("7","库位设置"), |
| | | new ScoreReport("8","存货档案"), |
| | | //new ScoreReport("8","存货档案"), |
| | | new ScoreReport("9","设备清单"), |
| | | //new ScoreReport("10","设备点检项目"), |
| | | //new ScoreReport("10_1","设备点检标准"), |
| | |
| | | //new ScoreReport("24","节拍工价"), |
| | | new ScoreReport("17","质检标准"), |
| | | new ScoreReport("18","缺陷定义"), |
| | | new ScoreReport("19","生产订单"), |
| | | new ScoreReport("20","库存查询"), |
| | | new ScoreReport("21","物料清单"), |
| | | //new ScoreReport("19","生产订单"), |
| | | //new ScoreReport("20","库存查询"), |
| | | //new ScoreReport("21","物料清单"), |
| | | }; |
| | | return list; |
| | | } |
| | |
| | | "AllowedHosts": "*", |
| | | //服务器环境 |
| | | "ConnectionStrings": { |
| | | "DBServer": "Data Source=121.196.36.24,1533;Initial Catalog=vmes_JL;User ID=sa;Password=xkd@20230101;pooling=false", |
| | | //"DBServer": "Data Source=121.196.36.24,1533;Initial Catalog=vmes_JL;User ID=sa;Password=xkd@20230101;pooling=false", |
| | | "DBServer": "Data Source=192.168.1.237,1433;Initial Catalog=vmes;User ID=sa;Password=123;pooling=false", |
| | | //企业编码 |
| | | "CompanyCode": "000", |
| | | //企业名称 |