huangxiaoqiang
9 小时以前 960b33fa24c47a330e51a2c24859d681ae62caeb
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs
@@ -67,7 +67,22 @@
        WebResponseContent content = new WebResponseContent();
        try
        {
            var boxingInfo = BaseDal.QueryFirst(x=>x.PalletCode == groupPlate.palletCode);
            if(boxingInfo != null)
            {
                return content.Error($"托盘号【{groupPlate.palletCode}】存在组盘信息");
            }
            var newBoxingInfo = new DtBoxingInfo
            {
                PalletCode = groupPlate.palletCode,
                MaterielName = groupPlate.group,
                StockStatus = (int)StockStateEmun.组盘暂存,
                IsFull = groupPlate.IsFull,
                Remark = string.Empty
            };
            await BaseDal.AddDataAsync(newBoxingInfo);
            return content.OK("组盘成功");
        }
        catch (Exception ex)
@@ -90,18 +105,16 @@
            {
                return content.Error("参数错误");
            }
            var boxingInfo = await BaseDal.QueryFirstNavAsync(x => x.PalletCode == groupPlate.palletCode);
            var boxingInfo = await BaseDal.QueryFirstAsync(x => x.PalletCode == groupPlate.palletCode);
            if (!boxingInfo.IsNullOrEmpty())
            {
                boxingInfo.StockStatus = (int)StockStateEmun.组盘撤销;
                DtBoxingInfo_Hty stockhty = boxingInfo.Adapt<DtBoxingInfo_Hty>();
                stockhty.ModifyDate = DateTime.Now;
                DtBoxingInfo_Hty boxinghty = boxingInfo.Adapt<DtBoxingInfo_Hty>();
                boxinghty.ModifyDate = DateTime.Now;
                boxinghty.StockStatus = (int)StockStateEmun.组盘撤销;
                await _unitOfWorkManage.UseTranAsync(async () =>
                {
                    await BaseDal.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxingInfo.Id)
                                            .Include(x => x.BoxingInfoDetails)
                                            .ExecuteCommandAsync();
                    await AddStockHtyAsync(stockhty);
                    await BaseDal.Db.Deleteable<DtBoxingInfo>(x => x.Id == boxingInfo.Id).ExecuteCommandAsync();
                    await AddBoxingHtyAsync(boxinghty);
                });
                content.OK("解盘成功");
            }
@@ -116,7 +129,7 @@
            return content.Error(ex.Message);
        }
    }
    private async Task AddStockHtyAsync(DtBoxingInfo_Hty stockhty)
    private async Task AddBoxingHtyAsync(DtBoxingInfo_Hty stockhty)
    {
        var isStockAdd = await SqlSugarHelper.DbWMS.InsertNav(stockhty).Include(x=>x.BoxingInfoDetails).ExecuteCommandAsync();
        if (!isStockAdd)