chengsc
2024-10-15 86985a3e211ab4cc1e94a696c15a6f77d21c462a
Wms/WMS.BLL/BllPdaServer/PdaSoServer.cs
@@ -520,6 +520,7 @@
                    Db.Updateable(pallet).ExecuteCommand();
                    //修改出库单明细拣货数量
                    noticeDetail.CompleteQty += pickQty;
                    noticeDetail.Status = "2";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                    var num = Db.Queryable<BllExportNoticeDetail>()
@@ -527,7 +528,10 @@
                    if (num <= 0)
                    {
                        notice.Status = "4"; //更改为执行完成
                        noticeDetail.Status = "3";
                        Db.Updateable(noticeDetail).ExecuteCommand();
                    }
                    //修改出库单信息
                    Db.Updateable(notice).ExecuteCommand();
                }
@@ -739,6 +743,7 @@
                    }
                    //修改出库单明细拣货数量
                    noticeDetail.CompleteQty += pickQty;
                    noticeDetail.Status = "2";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                    var num = Db.Queryable<BllExportNoticeDetail>()
@@ -746,6 +751,9 @@
                    if (num <= 0)
                    {
                        notice.Status = "4"; //更改为执行完成
                        noticeDetail.Status = "3";
                        Db.Updateable(noticeDetail).ExecuteCommand();
                    }
                    //修改出库单信息
                    Db.Updateable(notice).ExecuteCommand();
@@ -940,6 +948,7 @@
                //修改出库单明细拣货数量
                noticeDetail.CompleteQty += int.Parse(PickQty);
                noticeDetail.Status = "2";
                Db.Updateable(noticeDetail).ExecuteCommand();
                var num = Db.Queryable<BllExportNoticeDetail>()
@@ -947,6 +956,8 @@
                if (num <= 0)
                {
                    notice.Status = "4"; //更改为执行完成
                    noticeDetail.Status = "3";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                }
                //修改出库单信息
                Db.Updateable(notice).ExecuteCommand();
@@ -3857,10 +3868,14 @@
                {
                    throw new Exception("未查询到该出库单的信息");
                }
                if (notice.Status != "3")
                if (notice.Type != "1" && notice.Type != "2" && notice.Type != "3")
                {
                    throw new Exception("出库单的状态不是正在执行,不能拣货");
                    if (notice.Status != "3")
                    {
                        throw new Exception("出库单的状态不是正在执行,不能拣货");
                    }
                }
                //出库单明细
                var noticeDetail = Db.Queryable<BllExportNoticeDetail>()
                    .First(m => m.IsDel == "0" && m.Id == int.Parse(soDetailId));
@@ -3897,7 +3912,7 @@
                #region 拼托信息
                var sdId = 0;
                bool isNew = false;
                var pinStockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew && m.SkuNo == allot.SkuNo && m.LotNo == allot.LotNo);
                var pinStockDetail = Db.Queryable<DataStockDetail>().First(m => m.IsDel == "0" && m.PalletNo == palletNoNew);
                if (pinStockDetail != null)
                {
                    if (palletNo != palletNoNew)//非整托拣货
@@ -4068,6 +4083,7 @@
                   
                    //修改出库单明细拣货数量
                    noticeDetail.CompleteQty += pickQty;
                    noticeDetail.Status = "2";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                    var num = Db.Queryable<BllExportNoticeDetail>()
@@ -4075,6 +4091,8 @@
                    if (num <= 0)
                    {
                        notice.Status = "4"; //更改为执行完成
                        noticeDetail.Status = "3";
                        Db.Updateable(noticeDetail).ExecuteCommand();
                    }
                    //修改出库单信息
                    Db.Updateable(notice).ExecuteCommand();
@@ -4083,7 +4101,7 @@
                {
                    var biaoShi = "0";//0:整箱拣货、1:散支拣货、2:数量拣货
                    List<DataBoxInfo> boxInfos;
                    var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == boxNo);
                    var boxInfo = Db.Queryable<DataBoxInfo>().Where(m => m.IsDel == "0" && m.BoxNo == boxNo && m.StockDetailId == stockDetail.Id);
                    if (boxInfo.Count() == 0)
                    {
                        throw new Exception("未查询到该箱码及追溯码的信息");
@@ -4220,6 +4238,8 @@
                        }
                        else//数量拣货
                        {
                            var boxInfo2 = Db.Queryable<DataBoxInfo>().First(m => m.IsDel == "0" && m.BoxNo == boxNo && m.StockDetailId == sdId);
                            if (decimal.Parse(pickQty1) == item.Qty)
                            {
                                //修改库存箱码明细
@@ -4231,9 +4251,53 @@
                            }
                            else
                            {
                                if (boxInfo2 == null)
                                {
                                    var dataBoxInfo = new DataBoxInfo()
                                    {
                                        StockDetailId = sdId,
                                        BindNo = item.BindNo,
                                        BoxNo = item.BoxNo,
                                        BoxNo2 = item.BoxNo2,
                                        BoxNo3 = item.BoxNo3,
                                        PalletNo = item.PalletNo,
                                        PalletNo2 = item.PalletNo2,
                                        PalletNo3 = item.PalletNo3,
                                        Qty = decimal.Parse(pickQty1),
                                        FullQty = item.FullQty,
                                        Status = "4",
                                        LotNo = item.LotNo,
                                        LotText = item.LotText,
                                        SkuNo = item.SkuNo,
                                        SkuName = item.SkuName,
                                        Standard = item.Standard,
                                        ProductionTime = item.ProductionTime,
                                        SupplierLot = item.SupplierLot,
                                        InspectMark = item.InspectMark,
                                        BitBoxMark = "1",
                                        InspectStatus = item.InspectStatus,
                                        InspectTime = item.InspectTime,
                                    };
                                    Db.Insertable(dataBoxInfo).ExecuteCommand();
                                }
                                else
                                {
                                    boxInfo2.Qty += decimal.Parse(pickQty1);
                                    item.BitBoxMark = boxInfo2.Qty>= boxInfo2.FullQty? "0":"1" ;//零箱标识
                                    Db.Updateable(boxInfo2).ExecuteCommand();
                                }
                                item.Qty -= decimal.Parse(pickQty1);
                                item.BitBoxMark = "1";//零箱标识
                                Db.Updateable(item).ExecuteCommand();
                                if (item.Qty<=0)
                                {
                                    Db.Deleteable(item).ExecuteCommand();
                                }
                                else
                                {
                                    Db.Updateable(item).ExecuteCommand();
                                }
                            }
                            pickQty += int.Parse(pickQty1);
@@ -4300,6 +4364,7 @@
                    }
                    //修改出库单明细拣货数量
                    noticeDetail.CompleteQty += pickQty;
                    noticeDetail.Status = "2";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                    var num = Db.Queryable<BllExportNoticeDetail>()
@@ -4307,17 +4372,21 @@
                    if (num <= 0)
                    {
                        notice.Status = "4"; //更改为执行完成
                        noticeDetail.Status = "3";
                        Db.Updateable(noticeDetail).ExecuteCommand();
                    }
                    //修改出库单信息
                    Db.Updateable(notice).ExecuteCommand();
                }
                if (isNew)
                {
                    sd.Qty = pickQty;
                    sd.LockQty = pickQty;
                    var sd2 = Db.Queryable<DataStockDetail>().First(m=>m.Id == sdId);
                    sd2.Qty = pickQty;
                    sd2.LockQty = pickQty;
                    Db.Updateable(sd).ExecuteCommand();
                    Db.Updateable(sd2).ExecuteCommand();
                }
                else
                {
@@ -4633,6 +4702,7 @@
                //修改出库单明细拣货数量
                noticeDetail.CompleteQty += int.Parse(PickQty);
                noticeDetail.Status = "2";
                Db.Updateable(noticeDetail).ExecuteCommand();
                var num = Db.Queryable<BllExportNoticeDetail>()
@@ -4640,6 +4710,8 @@
                if (num <= 0)
                {
                    notice.Status = "4"; //更改为执行完成
                    noticeDetail.Status = "3";
                    Db.Updateable(noticeDetail).ExecuteCommand();
                }
                //修改出库单信息
                Db.Updateable(notice).ExecuteCommand();