¶Ô±ÈÐÂÎļþ |
| | |
| | | using Rhea.Common; |
| | | using Microsoft.AspNetCore.Http; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Linq.Expressions; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using System.Threading.Tasks; |
| | | using Tiger.Model; |
| | | using Apache.NMS; |
| | | using System.Drawing.Drawing2D; |
| | | using Tiger.Model.Sharetronic.Shelf; |
| | | using Tiger.IBusiness; |
| | | using Tiger.Model.MES.Yada; |
| | | using Apache.NMS.ActiveMQ.Commands; |
| | | using System.Diagnostics; |
| | | |
| | | namespace Tiger.Business.WMS.Transaction |
| | | { |
| | | /// <summary> |
| | | /// åæåå
¥åºæå°æ ç¾äºå¡ |
| | | /// </summary> |
| | | public class In_SemiProd : WMSTransactionBase, IIn_SemiProd |
| | | { |
| | | public IIn_SemiProd Init(string id, string userCode, string apiHost, string orgCode) |
| | | { |
| | | TransID = id; |
| | | UserCode = userCode; |
| | | ApiHost = apiHost; |
| | | OrgCode = orgCode; |
| | | Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]"); |
| | | return this; |
| | | } |
| | | |
| | | #region Propertys & Variables |
| | | public string UserCode { get; set; } |
| | | public long UserId { get; set; } |
| | | public string OrgCode { get; set; } |
| | | public string LocationCode { get; set; } |
| | | public List<V_WMS_ITEM> Vitem { get; set; } = new(); |
| | | public ScanShelfInfo CurScanShelf { get; set; } |
| | | |
| | | #endregion |
| | | |
| | | #region Functions |
| | | /// <summary> |
| | | /// æ«æå
¥å£ |
| | | /// </summary> |
| | | public async Task<ApiAction<ScanOutput>> Scan(BaseInput input) |
| | | { |
| | | var action = new ApiAction<ScanOutput>(new ScanOutput()); |
| | | try |
| | | { |
| | | if (input.SN.IsNullOrEmpty()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | action.LocaleMsg = Biz.L("WMS.RePrint.ScanItem.SnEmptyFailure"); |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | var LotNos = Biz.DataSource["YadaU9C"].Client.Ado.SqlQuery<mes_WhLotCodeQtyInfo>($"select *,'' as ID from mes_WhLotCodeQtyInfo where Bin = '{input.SN}'"); |
| | | //Biz.DataSource["YadaU9C"].Client.Queryable<mes_WhLotCodeQtyInfo>().Where(t => t.Bin == input.SN).ToList(); |
| | | CurScanShelf = new ScanShelfInfo(); |
| | | // æ¥è¯¢è´§æ¶ä¿¡æ¯ |
| | | var whUnit = await Biz.Db.Queryable<V_WH_UNIT>().Where(t => (t.SHELF_CODE.ToUpper() == input.SN || t.LOCATION_CODE.ToUpper() == input.SN) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync(); |
| | | if (!whUnit.IsNullOrEmpty() && whUnit.LOCATION_CODE == input.SN) |
| | | { |
| | | if (whUnit.IS_ACTIVE == "N") |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("æ«æçå¨ä½[{0}]æªå¯ç¨"); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfOrLocationDisabled", input.SN); |
| | | return action; |
| | | } |
| | | if (whUnit.Shelf.IsLightShelf || whUnit.Location.IS_SINGLE == "Y") |
| | | { |
| | | var locationData = Biz.Db.Queryable<WMS_ITEM>().Where(q => q.LOCATION_ID == whUnit.LOCATION_ID && q.AUTH_ORG == OrgCode).First(); |
| | | if (!locationData.IsNullOrEmpty()) |
| | | { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("å¨ä½[{0}]å·²åæç©æ[{1}]ï¼è¯·æ£æ¥ç³»ç»åºåä¿¡æ¯"); |
| | | action.LocaleMsg = Biz.L($"WMS.Default.ScanShelf.ItemAlreadyExistsInLocation", input.SN, locationData.SN); |
| | | return action; |
| | | } |
| | | } |
| | | CurScanShelf.Shelf = whUnit.Shelf; |
| | | CurScanShelf.Location = whUnit.Location; |
| | | CurScanShelf.WarehouseCode = whUnit.WH_CODE; |
| | | CurScanShelf.RegionCode = whUnit.REGION_CODE; |
| | | CurScanShelf.ShelfCode = whUnit.SHELF_CODE; |
| | | CurScanShelf.LocationCode = whUnit.LOCATION_CODE; |
| | | CurScanShelf.IsSmartRack = false; |
| | | LocationCode = whUnit.LOCATION_CODE; |
| | | } |
| | | else { |
| | | action.IsSuccessed = false; |
| | | //action.LocaleMsg = Biz.L("请è¾å
¥ææ«æææçè´§æ¶/å¨ä½ç "); |
| | | action.LocaleMsg = Biz.L("WMS.Default.ScanShelf.ShelfCanNotEmpty"); |
| | | return action; |
| | | } |
| | | var temps = new List<TemplateInput>(); |
| | | foreach (var item in LotNos) |
| | | { |
| | | var temp = new TemplateInput |
| | | { |
| | | custCode="", |
| | | itemCode= item.ItemCode, |
| | | itemDesc= item.Description, |
| | | sapItemCode= item.SapCode, |
| | | WoBatch = item.LotCode, |
| | | batchQty= item.StoreQty, |
| | | qrCode="", |
| | | }; |
| | | temps.Add(temp); |
| | | } |
| | | |
| | | var y = Biz.Db.Storageable(LotNos, UserCode) |
| | | .WhereColumns(t => new { t.ItemCode, t.LotCode }) |
| | | .ToStorage(); |
| | | y.AsInsertable.ExecuteCommand(); |
| | | y.AsUpdateable.IgnoreColumns(x => x.ID).ExecuteCommand(); |
| | | action.Data.Data = temps; |
| | | action.LocaleMsg = Biz.L("WMS.RePrint.ScanItem.ScanSuccessed"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //action.CatchExceptionWithLog(ex, $"æ«æ[{input.SN}]å¼å¸¸"); |
| | | action.CatchExceptionWithLog(ex, Biz.L("WMS.RePrint.Scan.ScanException", input.SN)); |
| | | } |
| | | return SetOutPutMqttMsg(action, input.Locale); |
| | | } |
| | | |
| | | public async Task<ApiAction<ScanOutput>> ScanItem(BaseInput input) |
| | | { |
| | | var action = new ApiAction<ScanOutput>(new ScanOutput()); |
| | | try |
| | | { |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | action.CatchExceptionWithLog(ex, Biz.L("åæåå
¥åºå¤±è´¥")); |
| | | } |
| | | return action; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | public override bool Close(bool needSaveHistoryLog = false) |
| | | { |
| | | needSaveHistoryLog = true; |
| | | //ä¿åæä½æ¥å¿ |
| | | |
| | | this.IsFinished = true; |
| | | return IsFinished ? base.Close(needSaveHistoryLog) : IsFinished; |
| | | } |
| | | |
| | | }//endClass |
| | | } |