Demo
2024-02-19 d3521d4f8feda989df7f0f48eff6ee3fd6ebec47
Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -614,30 +614,35 @@
                var modelList = new List<BllBoxInfo>();
                var addLotNo = "";
                if (arriveQty < 0)
                {
                    throw new Exception("到货数量不能小于0!");
                }
                if (packLevel == 1)
                {
                    #region 一级包装
                    // 根据用户输入的箱数量计算需要的条码数
                    var labQty = label.Sum(m => m.Qty);
                    var qty = asnList.Qty - labQty;//当前单据剩余需要打印的物料数量(不是标签数量)
                    if (qty <= 0)
                    {
                        throw new Exception("当前单据物料标签已打印完毕,如有需要请补打");
                    }
                    //var labQty = label.Sum(m => m.Qty);
                    //var qty = asnList.Qty - labQty;//当前单据剩余需要打印的物料数量(不是标签数量)
                    //if (qty <= 0)
                    //{
                    //    throw new Exception("当前单据物料标签已打印完毕,如有需要请补打");
                    //}
                    #region 到货数量
                    if (arriveQty - qty > 0)
                    {
                        throw new Exception("到货数量大于未打标签数量,请重新输入到货数量并核实!");
                    }
                    else
                    {
                        qty = arriveQty;
                    }
                    //if (arriveQty - qty > 0)
                    //{
                    //    throw new Exception("到货数量大于未打标签数量,请重新输入到货数量并核实!");
                    //}
                    //else
                    //{
                    //    qty = arriveQty;
                    //}
                    var qty = arriveQty;
                    #endregion
                    int labelNum = 1; //生产条码数量
@@ -672,7 +677,7 @@
                    }
                    else
                    {
                        var maxCode = Db.Queryable<BllLabelBoxNo>().Max(a => a.LotNo);                        // 获取今天最大批次号
                        var maxCode = Db.Queryable<BllBoxInfo>().Where(m=>m.Origin == "WMS生成").Max(a => a.LotNo);                        // 获取今天最大批次号
                        if (string.IsNullOrWhiteSpace(maxCode))
                        {
                            maxLotNoStr = toDayTime.Substring(2, 6) + "0001";
@@ -769,25 +774,27 @@
                    #region 二级包装
                    // 根据用户输入的箱数量计算需要的条码数
                    var labQty = label.Sum(m => m.Qty);
                    var qty2 = asnList.Qty - labQty;
                    if (qty2 <= 0)
                    {
                        throw new Exception("当前单据物料标签已打印完毕,如有需要请补打");
                    }
                    //var labQty = label.Sum(m => m.Qty);
                    //var qty2 = asnList.Qty - labQty;
                    //if (qty2 <= 0)
                    //{
                    //    throw new Exception("当前单据物料标签已打印完毕,如有需要请补打");
                    //}
                    #region 增加到货数量
                    if (arriveQty - qty2 > 0)
                    {
                        throw new Exception("到货数量大于未打标签数量,请重新输入到货数量!");
                    }
                    else
                    {
                        qty2 = arriveQty;
                    }
                    //if (arriveQty - qty2 > 0)
                    //{
                    //    throw new Exception("到货数量大于未打标签数量,请重新输入到货数量!");
                    //}
                    //else
                    //{
                    //    qty2 = arriveQty;
                    //}
                    #endregion
                    var qty2 = arriveQty;
                    int labelNum2 = 1; //生产箱条码数量
                    labelNum2 = int.Parse(Math.Ceiling(qty2 / bNum).ToString());
@@ -819,7 +826,7 @@
                    }
                    else
                    {
                        var maxCode = Db.Queryable<BllLabelBoxNo>().Max(a => a.LotNo);                        // 获取今天最大批次号
                        var maxCode = Db.Queryable<BllBoxInfo>().Where(m => m.Origin == "WMS生成").Max(a => a.LotNo);                        // 获取今天最大批次号
                        if (string.IsNullOrWhiteSpace(maxCode))
                        {
                            maxCodestr2 = toDayTime2.Substring(2, 6) + "0001";
@@ -1512,7 +1519,7 @@
                                        model1.Qty = item.Qty;// 数量
                                        model1.BoxNo = item.BoxNo3;                 // 支号     
                                        model.ImgStr = BarcodeHelper.GetCodeBarBase64(model1.BoxNo, 160, 40, false);
                                        model1.ImgStr = BarcodeHelper.GetCodeBarBase64(model1.BoxNo, 160, 40, false);
                                        // 添加到list集合
                                        printModelList.Add(model1);
@@ -1543,9 +1550,6 @@
                #endregion
                //dataContext.WmsLabelPrintLog.InsertAllOnSubmit(printlog);
                //    dataContext.SubmitChanges();
                //    return printModel;
                return printModelList;
            }
            catch (Exception e)