| | |
| | | using wcftest.Model.Output; |
| | | using wcftest.orm_test; |
| | | using wcftest.Utils.AuthFacotry; |
| | | using System.Linq.Expressions; |
| | | |
| | | |
| | | namespace wcftest.wcf |
| | |
| | | data.Add(waitStatus); |
| | | |
| | | //x轴顺序重新排序 【Editby shaocx,2024-12-30】 |
| | | xdata = xdata.OrderBy(x=>x).ToList(); |
| | | xdata = xdata.OrderBy(x => x).ToList(); |
| | | string[] legend = { "p设备运行时间", "p设备等待时间", "p设备异常时间" }; |
| | | var workpiece = new |
| | | { |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分页查询 堆垛机运行统计 |
| | | /// </summary> |
| | | /// <param name="param"></param> |
| | | /// <returns></returns> |
| | | public string QueryPageDeviceGeneralInfo(string param) |
| | | { |
| | | msgss<deviceGeneralInfo> msg = new msgss<deviceGeneralInfo>(); |
| | | DeviceGeneralInfoInput page = JsonConvert.DeserializeObject<DeviceGeneralInfoInput>(param); |
| | | try |
| | | { |
| | | using (dbModel mod = new dbModel()) |
| | | { |
| | | List<deviceGeneralInfo> fiveDayDeviceInfo = null; |
| | | if (page.datatime == null) |
| | | { |
| | | fiveDayDeviceInfo = mod.deviceGeneralInfo |
| | | .OrderByDescending(x => x.createTime) |
| | | .ToList(); |
| | | } |
| | | else |
| | | { |
| | | DateTime _startTime = Convert.ToDateTime(page.datatime[0]); |
| | | DateTime _endTime = Convert.ToDateTime(page.datatime[1]); |
| | | fiveDayDeviceInfo = mod.deviceGeneralInfo |
| | | .Where(x => x.createTime >= _startTime && x.createTime <= _endTime) |
| | | .OrderByDescending(x => x.createTime) |
| | | .ToList(); |
| | | } |
| | | |
| | | if (fiveDayDeviceInfo.Count > 0) |
| | | { |
| | | foreach (var item in fiveDayDeviceInfo) |
| | | { |
| | | //重新计算等待时间 |
| | | item.deviceWaitTime = 1440 - ((item.deviceRunTime ?? 0M) + (item.deviceAlarmTime ?? 0M)); |
| | | } |
| | | } |
| | | |
| | | List<deviceGeneralInfo> fenyeRerult = new List<deviceGeneralInfo>(); |
| | | if (fiveDayDeviceInfo.Count > 0) |
| | | { |
| | | msg.status = 200; |
| | | msg.total = fiveDayDeviceInfo.Count; |
| | | if (page.IsLoadAllData) |
| | | {//只有确定加载全部数据时才加载全部数据 [EditBy shaocx,2022-03-07] |
| | | msg.status = 200; |
| | | msg.allDate = fiveDayDeviceInfo.ToList(); |
| | | } |
| | | else |
| | | {//不加载全部,就过滤分页信息 |
| | | //假如每页数量 大于盘点数据 |
| | | if (page.queryInfo.pagesize > fiveDayDeviceInfo.Count) |
| | | { |
| | | msg.date = fiveDayDeviceInfo; |
| | | } |
| | | else |
| | | { |
| | | #region 分页计算 |
| | | int a = page.queryInfo.pagesize; |
| | | |
| | | int b = page.queryInfo.pagenum; |
| | | int c = (int)Math.Ceiling((double)fiveDayDeviceInfo.Count / a); |
| | | int d = fiveDayDeviceInfo.Count % a; |
| | | int e = 0; |
| | | int f = a * (b - 1); |
| | | if (d != 0 && b == c) |
| | | { |
| | | e = d + f; |
| | | |
| | | } |
| | | else |
| | | { |
| | | e = a + f; |
| | | } |
| | | |
| | | |
| | | |
| | | for (int i = f; i < e; i++) |
| | | { |
| | | fenyeRerult.Add(fiveDayDeviceInfo[i]); |
| | | } |
| | | msg.date = fenyeRerult; |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | msg.status = 400; |
| | | msg.total = 1; |
| | | msg.date = null; |
| | | } |
| | | |
| | | |
| | | return JsonConvert.SerializeObject(msg); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | logtxt.txtWrite("出错信息" + ex.Message + "出错行号" + (string)ex.StackTrace, 2); |
| | | msg.status = 400; |
| | | msg.total = 1; |
| | | msg.date = null; |
| | | |
| | | return JsonConvert.SerializeObject(msg); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 分页查询 PO明细空物料号信息 |
| | | /// </summary> |
| | | /// <param name="param"></param> |
| | | /// <returns></returns> |
| | | public string QueryPagePurchaseEmptyMaterialCode(string param) |
| | | { |
| | | msgss<Purchase_OrderList_EmptyMaterialCode> msg = new msgss<Purchase_OrderList_EmptyMaterialCode>(); |
| | | Purchase_OrderList_EmptyMaterialCodeInput page = JsonConvert.DeserializeObject<Purchase_OrderList_EmptyMaterialCodeInput>(param); |
| | | try |
| | | { |
| | | using (dbModel mod = new dbModel()) |
| | | { |
| | | List<Purchase_OrderList_EmptyMaterialCode> fiveDayDeviceInfo = new List<Purchase_OrderList_EmptyMaterialCode>(); |
| | | |
| | | Expression<Func<Purchase_OrderList_EmptyMaterialCode, bool>> predicate_datatime = x => 1 == 1; |
| | | if (page.datatime != null) |
| | | { |
| | | DateTime _startTime = Convert.ToDateTime(page.datatime[0]); |
| | | DateTime _endTime = Convert.ToDateTime(page.datatime[1]); |
| | | predicate_datatime = x => x.CreateTime >= _startTime && x.CreateTime <= _endTime; |
| | | } |
| | | Expression<Func<Purchase_OrderList_EmptyMaterialCode, bool>> predicate_poCode = x => 1 == 1; |
| | | if (!string.IsNullOrEmpty(page.search.PoCode)) |
| | | { |
| | | predicate_poCode = x => x.PoCode == page.search.PoCode; |
| | | } |
| | | Expression<Func<Purchase_OrderList_EmptyMaterialCode, bool>> predicate_ItemNumber = x => 1 == 1; |
| | | if (!string.IsNullOrEmpty(page.search.ItemNumber)) |
| | | { |
| | | predicate_poCode = x => x.ItemNumber == page.search.ItemNumber; |
| | | } |
| | | Expression<Func<Purchase_OrderList_EmptyMaterialCode, bool>> predicate_ProductName = x => 1 == 1; |
| | | if (!string.IsNullOrEmpty(page.search.ProductName)) |
| | | { |
| | | predicate_poCode = x => x.ProductName == page.search.ProductName; |
| | | } |
| | | fiveDayDeviceInfo = mod.Purchase_OrderList_EmptyMaterialCode |
| | | .Where(predicate_datatime) |
| | | .Where(predicate_poCode) |
| | | .Where(predicate_ItemNumber) |
| | | .Where(predicate_ProductName) |
| | | .ToList(); |
| | | |
| | | |
| | | List<Purchase_OrderList_EmptyMaterialCode> fenyeRerult = new List<Purchase_OrderList_EmptyMaterialCode>(); |
| | | if (fiveDayDeviceInfo.Count > 0) |
| | | { |
| | | msg.status = 200; |
| | | msg.total = fiveDayDeviceInfo.Count; |
| | | if (page.IsLoadAllData) |
| | | {//只有确定加载全部数据时才加载全部数据 [EditBy shaocx,2022-03-07] |
| | | msg.status = 200; |
| | | msg.allDate = fiveDayDeviceInfo.ToList(); |
| | | } |
| | | else |
| | | {//不加载全部,就过滤分页信息 |
| | | //假如每页数量 大于盘点数据 |
| | | if (page.queryInfo.pagesize > fiveDayDeviceInfo.Count) |
| | | { |
| | | msg.date = fiveDayDeviceInfo; |
| | | } |
| | | else |
| | | { |
| | | #region 分页计算 |
| | | int a = page.queryInfo.pagesize; |
| | | |
| | | int b = page.queryInfo.pagenum; |
| | | int c = (int)Math.Ceiling((double)fiveDayDeviceInfo.Count / a); |
| | | int d = fiveDayDeviceInfo.Count % a; |
| | | int e = 0; |
| | | int f = a * (b - 1); |
| | | if (d != 0 && b == c) |
| | | { |
| | | e = d + f; |
| | | |
| | | } |
| | | else |
| | | { |
| | | e = a + f; |
| | | } |
| | | |
| | | |
| | | |
| | | for (int i = f; i < e; i++) |
| | | { |
| | | fenyeRerult.Add(fiveDayDeviceInfo[i]); |
| | | } |
| | | msg.date = fenyeRerult; |
| | | #endregion |
| | | |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | msg.status = 400; |
| | | msg.total = 1; |
| | | msg.date = null; |
| | | } |
| | | |
| | | |
| | | return JsonConvert.SerializeObject(msg); |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | logtxt.txtWrite("出错信息" + ex.Message + "出错行号" + (string)ex.StackTrace, 2); |
| | | msg.status = 400; |
| | | msg.total = 1; |
| | | msg.date = null; |
| | | |
| | | return JsonConvert.SerializeObject(msg); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary>2d动画获取设备位置 |
| | | /// 2d动画获取设备位置 |
| | |
| | | var checkMateria1s = (from p in mod.Base_ProductInfo where (from f in rstPo select f).Contains(p.ProductCode) select p).ToList(); |
| | | |
| | | #region 添加PO单物料明细 |
| | | System.Collections.Generic.List<Purchase_OrderList_EmptyMaterialCode> insert_OrderList_EmptyMaterialCodeList = new List<Purchase_OrderList_EmptyMaterialCode>(); |
| | | string lastTracknum = ""; |
| | | foreach (var item in resultPo.Materials) |
| | | { |
| | | if (item.MaterialCode == null) |
| | | { |
| | | if (string.IsNullOrEmpty(item.MaterialCode)) |
| | | {//写入PO明细空物料号表 【Editby shaocx,2025-09-09】 |
| | | logtxt.txtWrite("采购单号:" + item.PoNumber + " 物料项号:" + item.PoItem + "物料编号为空", 2); |
| | | insert_OrderList_EmptyMaterialCodeList.Add(new Purchase_OrderList_EmptyMaterialCode() |
| | | { |
| | | ID = Yitter.IdGenerator.YitIdHelper.NextId(), |
| | | PoCode = poInfo.PoCode, |
| | | BatchNumber = "", |
| | | ItemNumber = item.PoItem, |
| | | ProductName = item.MaterialName, |
| | | CreateTime = DateTime.Now, |
| | | Creator = resultPo.CreatedBy, |
| | | Quantity = 0, |
| | | LastModifier = resultPo.CreatedBy, |
| | | LastModifyTime = DateTime.Now, |
| | | Remark = "" |
| | | }); |
| | | continue;//物料编号为空 |
| | | } |
| | | string materialCode = item.MaterialCode; |
| | |
| | | #endregion |
| | | //先保存主表 然后获取主表ID 再写入明细表 |
| | | mod.Purchase_Order.Add(poInfo); |
| | | |
| | | if (insert_OrderList_EmptyMaterialCodeList != null && insert_OrderList_EmptyMaterialCodeList.Count > 0) |
| | | {//写入PO明细空物料号表 【Editby shaocx,2025-09-09】 |
| | | mod.Purchase_OrderList_EmptyMaterialCode.AddRange(insert_OrderList_EmptyMaterialCodeList); |
| | | } |
| | | |
| | | int results = mod.SaveChanges(); |
| | | for (int h = 0; h < 10; h++) |
| | | { |