ÎļþÃû´Ó Tiger.Business/WMS/Biz.WMS_ITEM.cs ÐÞ¸Ä |
| | |
| | | using Microsoft.CodeAnalysis; |
| | | using Org.BouncyCastle.Ocsp; |
| | | using Rhea.Common; |
| | | using SqlSugar; |
| | | using System; |
| | |
| | | using System.DirectoryServices.ActiveDirectory; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using Tiger.Business.WMS; |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model; |
| | | |
| | | namespace Tiger.Business |
| | | namespace Tiger.Business.WMS |
| | | { |
| | | public partial class Biz |
| | | public class WMS_ITEM_Biz |
| | | { |
| | | private static _Biz_WmsItem _WmsItem = new(); |
| | | |
| | |
| | | var unPackQty = result.Data.Items.Sum(q => q.QTY); |
| | | db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.PARENT_SN == null).Where(q => q.ID == query.ID).ExecuteCommand(); |
| | | db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.QTY == q.QTY - unPackQty).Where(q => q.ID == query.Parent.ID).ExecuteCommand(); |
| | | if (!db.Queryable<WMS_ITEM_PKG>().Any(q => q.PARENT_SN == query.PARENT_SN && q.SN != query.SN)) |
| | | if (!Biz.Db.Queryable<WMS_ITEM_PKG>().Any(q => q.PARENT_SN == query.PARENT_SN && q.SN != query.SN)) |
| | | { |
| | | db.Deleteable(query.Parent); |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, L("WMS.WmsItem.Barcode.GetException", sn)); |
| | | result.CatchExceptionWithLog(ex, Biz.L("WMS.WmsItem.Barcode.GetException", sn)); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | var unPackQty = result.Data.Items.Sum(q => q.QTY); |
| | | db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.PARENT_SN == null).Where(q => q.ID == query.ID).ExecuteCommand(); |
| | | db.Updateable<WMS_ITEM_PKG>().SetColumns(q => q.QTY == q.QTY - unPackQty).Where(q => q.ID == query.Parent.ID).ExecuteCommand(); |
| | | if (!db.Queryable<WMS_ITEM_PKG>().Any(q => q.PARENT_SN == query.PARENT_SN && q.SN != query.SN)) |
| | | if (!Biz.Db.Queryable<WMS_ITEM_PKG>().Any(q => q.PARENT_SN == query.PARENT_SN && q.SN != query.SN)) |
| | | { |
| | | db.Deleteable(query.Parent); |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, L("WMS.WmsItem.Barcode.GetException", sn)); |
| | | result.CatchExceptionWithLog(ex, Biz.L("WMS.WmsItem.Barcode.GetException", sn)); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, L("WMS.WmsItem.PutOn.Exception", inventory.SN, targetLocation)); |
| | | result.CatchExceptionWithLog(ex, Biz.L("WMS.WmsItem.PutOn.Exception", inventory.SN, targetLocation)); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, L("WMS.WmsItem.TakeDown.Exception", inventory.SN, inventory?.Location?.LOCATION_CODE)); |
| | | result.CatchExceptionWithLog(ex, Biz.L("WMS.WmsItem.TakeDown.Exception", inventory.SN, inventory?.Location?.LOCATION_CODE)); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, L("WMS.WmsItem.Suggest.Exception")); |
| | | result.CatchExceptionWithLog(ex, Biz.L("WMS.WmsItem.Suggest.Exception")); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | result.CatchExceptionWithLog(ex, L("WMS.WmsItem.Suggest.Exception")); |
| | | result.CatchExceptionWithLog(ex, Biz.L("WMS.WmsItem.Suggest.Exception")); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | /// <returns></returns> |
| | | public string GetQRCode(string sn) |
| | | { |
| | | return Db.Queryable<WMS_ITEM>().Where(q => q.SN == sn).First()?.GetQRCode(); |
| | | return Biz.Db.Queryable<WMS_ITEM>().Where(q => q.SN == sn).First()?.GetQRCode(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | var action = new ApiAction<PageAble<V_WMS_ITEM>>(); |
| | | if (input.Code != "") |
| | | { |
| | | var query = Db.Queryable<V_WMS_ITEM>().ByAuth(input.AuthOption).Where(q => q.LOCATION_CODE == input.Code).ToPage(input.pageIndex, input.pageSize); |
| | | var query = Biz.Db.Queryable<V_WMS_ITEM>().ByAuth(input.AuthOption).Where(q => q.LOCATION_CODE == input.Code).ToPage(input.pageIndex, input.pageSize); |
| | | if (query.data.Count > 0) |
| | | { |
| | | action.Data = query; |
| | |
| | | /// <returns></returns> |
| | | public PageAble<V_WMS_ITEM> QueryItemSum(QueryItemInputDtl input) |
| | | { |
| | | var ItemCode = Db.Queryable<WMS_ITEM_PKG>().ByAuth(input.AuthOption).Where(q => q.SN == input.Code).First()?.ITEM_CODE ?? |
| | | var ItemCode = Biz.Db.Queryable<WMS_ITEM_PKG>().ByAuth(input.AuthOption).Where(q => q.SN == input.Code).First()?.ITEM_CODE ?? |
| | | (input.IsK.IsNullOrEmpty() ? input.Code : (((bool)input.IsK ? "K" : "") + new Barcode(input.Code).ItemCode)); |
| | | var itemInfo = Db.Queryable<BAS_ITEM>().Where(q => q.ITEM_CODE == ItemCode).First(); |
| | | var itemInfo = Biz.Db.Queryable<BAS_ITEM>().Where(q => q.ITEM_CODE == ItemCode).First(); |
| | | if (!itemInfo.IsNullOrEmpty()) |
| | | { |
| | | var sumInfo = Db.Queryable<V_WMS_ITEM>().Where(q => q.ITEM_CODE == ItemCode && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()) |
| | | var sumInfo = Biz.Db.Queryable<V_WMS_ITEM>().Where(q => q.ITEM_CODE == ItemCode && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()) |
| | | .ByAuth(input.AuthOption).GroupBy(q => new { q.WH_CODE, q.ITEM_CODE }).Select(q => new { WH_CODE = q.WH_CODE, SumQty = SqlFunc.AggregateSum(q.QTY) }).ToList(); |
| | | var items = Db.Queryable<V_WMS_ITEM>().Where(q => q.ITEM_CODE == ItemCode && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()) |
| | | var items = Biz.Db.Queryable<V_WMS_ITEM>().Where(q => q.ITEM_CODE == ItemCode && q.STATUS == WMS_ITEM.STATUSs.InStore.GetValue()) |
| | | .ByAuth(input.AuthOption).ToPage(input.pageIndex, input.pageSize); |
| | | items.data2 = new { ItemCode = ItemCode, ItemName = itemInfo.ITEM_NAME, SumInfo = $"{string.Join("\r\n", sumInfo.Select(q => $"{q.WH_CODE}æ»åºå: {(double)q.SumQty}"))}" }; |
| | | return items; |
| | |
| | | public static List<string> GetOrgList() |
| | | { |
| | | var DB = Biz.DataSource["WMS57"].Client; |
| | | var dataList = DB.Queryable<SYS_ORGANIZATION>().Select(i => i.ORG_CODE).Distinct().ToList();// è·åç»ç»ç¼ç |
| | | var dataList = Biz.Db.Queryable<SYS_ORGANIZATION>().Select(i => i.ORG_CODE).Distinct().ToList();// è·åç»ç»ç¼ç |
| | | |
| | | return dataList; |
| | | } |