|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | static object locker = new object(); | 
|---|
|  |  |  | public override WebResponseContent AddData(SaveModel saveModel) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int warehouseId = 0; | 
|---|
|  |  |  | int count = 0; | 
|---|
|  |  |  | if (saveModel.MainData.TryGetValue("warehouseId", out object? warehouse) && warehouse != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | warehouseId = warehouse.ObjToInt(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (saveModel.MainData.TryGetValue("count", out object? countValue) && countValue != null) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | count = countValue.ObjToInt(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | lock (locker) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | List<Dt_PalletCodeInfo> palletCodeInfos = new List<Dt_PalletCodeInfo>(); | 
|---|
|  |  |  | int serialNo = 0; | 
|---|
|  |  |  | DateTime now = DateTime.Now; | 
|---|
|  |  |  | Dt_PalletCodeInfo palletCodeInfo = BaseDal.QueryFirst(x => x.WarehouseId == warehouseId, new Dictionary<string, OrderByType> { { nameof(Dt_PalletCodeInfo.SerialNo), OrderByType.Desc } }); | 
|---|
|  |  |  | if (palletCodeInfo != null && palletCodeInfo.CreateDate.Year == now.Year && palletCodeInfo.CreateDate.Month == now.Month && palletCodeInfo.CreateDate.Day == now.Day) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | serialNo = palletCodeInfo.SerialNo + 1; | 
|---|
|  |  |  | //public override WebResponseContent AddData(SaveModel saveModel) | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | //    int warehouseId = 0; | 
|---|
|  |  |  | //    int count = 0; | 
|---|
|  |  |  | //    if (saveModel.MainData.TryGetValue("warehouseId", out object? warehouse) && warehouse != null) | 
|---|
|  |  |  | //    { | 
|---|
|  |  |  | //        warehouseId = warehouse.ObjToInt(); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //    if (saveModel.MainData.TryGetValue("count", out object? countValue) && countValue != null) | 
|---|
|  |  |  | //    { | 
|---|
|  |  |  | //        count = countValue.ObjToInt(); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //    lock (locker) | 
|---|
|  |  |  | //    { | 
|---|
|  |  |  | //        List<Dt_PalletCodeInfo> palletCodeInfos = new List<Dt_PalletCodeInfo>(); | 
|---|
|  |  |  | //        int serialNo = 0; | 
|---|
|  |  |  | //        DateTime now = DateTime.Now; | 
|---|
|  |  |  | //        Dt_PalletCodeInfo palletCodeInfo = BaseDal.QueryFirst(x => x.WarehouseId == warehouseId, new Dictionary<string, OrderByType> { { nameof(Dt_PalletCodeInfo.SerialNo), OrderByType.Desc } }); | 
|---|
|  |  |  | //        if (palletCodeInfo != null && palletCodeInfo.CreateDate.Year == now.Year && palletCodeInfo.CreateDate.Month == now.Month && palletCodeInfo.CreateDate.Day == now.Day) | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            serialNo = palletCodeInfo.SerialNo + 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | serialNo = 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Dt_Warehouse _Warehouse = _warehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); | 
|---|
|  |  |  | string uplen = ""; | 
|---|
|  |  |  | switch (_Warehouse.WarehouseCode) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | "HA57" => "B", | 
|---|
|  |  |  | "HA58" => "P", | 
|---|
|  |  |  | "HA152" => "G", | 
|---|
|  |  |  | "HA64" => "S", | 
|---|
|  |  |  | "é»çä»" => "Z", | 
|---|
|  |  |  | "HA153" => "Y", | 
|---|
|  |  |  | "HA71" => "C", | 
|---|
|  |  |  | "HA60" => "F", | 
|---|
|  |  |  | _ => "N" | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | for (int i = 0; i < count; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        else | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            serialNo = 1; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        Dt_Warehouse _Warehouse = _warehouseRepository.QueryFirst(x => x.WarehouseId == warehouseId); | 
|---|
|  |  |  | //        string uplen = ""; | 
|---|
|  |  |  | //        uplen = _Warehouse.WarehouseCode switch | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  | //            "HA57" => "B", | 
|---|
|  |  |  | //            "HA58" => "P", | 
|---|
|  |  |  | //            "HA152" => "G", | 
|---|
|  |  |  | //            "HA64" => "S", | 
|---|
|  |  |  | //            "é»çä»" => "Z", | 
|---|
|  |  |  | //            "HA153" => "Y", | 
|---|
|  |  |  | //            "HA71" => "C", | 
|---|
|  |  |  | //            "HA60" => "F", | 
|---|
|  |  |  | //            _ => "N" | 
|---|
|  |  |  | //        }; | 
|---|
|  |  |  | //        for (int i = 0; i < count; i++) | 
|---|
|  |  |  | //        { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | palletCodeInfos.Add(new Dt_PalletCodeInfo | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SerialNo = serialNo, | 
|---|
|  |  |  | PalletCode = uplen + now.ToString("yyyyMMdd") + serialNo.ToString().PadLeft(3, '0'), | 
|---|
|  |  |  | PalletType = 1, | 
|---|
|  |  |  | PalletTypeId = 0, | 
|---|
|  |  |  | WarehouseId = warehouseId, | 
|---|
|  |  |  | Status = 0, | 
|---|
|  |  |  | Size = 0 | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | //            palletCodeInfos.Add(new Dt_PalletCodeInfo | 
|---|
|  |  |  | //            { | 
|---|
|  |  |  | //                SerialNo = serialNo, | 
|---|
|  |  |  | //                PalletCode = uplen + now.ToString("yyyyMMdd") + serialNo.ToString().PadLeft(3, '0'), | 
|---|
|  |  |  | //                PalletType = 1, | 
|---|
|  |  |  | //                PalletTypeId = 0, | 
|---|
|  |  |  | //                WarehouseId = warehouseId, | 
|---|
|  |  |  | //                Status = 0, | 
|---|
|  |  |  | //                Size = 0 | 
|---|
|  |  |  | //            }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | serialNo = serialNo + 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return base.AddData(palletCodeInfos); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //            serialNo = serialNo + 1; | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  | //        return base.AddData(palletCodeInfos); | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //    } | 
|---|
|  |  |  | //} | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public WebResponseContent AddData(int warehouseId, int count, int palletTypeId) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return WebResponseContent.Instance.OK(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catch(Exception ex) | 
|---|
|  |  |  | catch (Exception ex) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return WebResponseContent.Instance.Error(ex.Message); | 
|---|
|  |  |  | } | 
|---|