Demo
2024-02-03 75b62c70cb63bc3ed438485573dacce93b43d55c
Wms/WMS.BLL/BllAsnServer/BllBoxInfoServer.cs
@@ -529,7 +529,7 @@
        }
        //获取标签信息(生成标签)
        public List<BoxInfoDto> AddLabelBoxReturn(int imId, string isReset, decimal arriveQty, string productionTime, string expirationTime, string storeTime, int userId)
        public List<BllBoxInfo> AddLabelBox(int imId, string isReset, decimal arriveQty, string productionTime, string expirationTime, string storeTime, int userId)
        {
            try
            { 
@@ -586,40 +586,14 @@
                var bNum = 0;//箱物品数量
                var zNum = 0;//支物品数量
                var packLevel = 0;
                var isGo = true;
                if (pack.L5Num.HasValue)
                {
                    if (pack.L5Name != "托")
                    {
                        isGo = false;
                        packLevel = 5;
                        bNum = Convert.ToInt32(pack.L5Num);
                    }
                }
                if (pack.L4Num.HasValue && isGo)
                {
                    if (pack.L4Name != "托")
                    {
                        isGo = false;
                        packLevel = 4;
                        bNum = Convert.ToInt32(pack.L4Num);
                    }
                }
                if (pack.L3Num.HasValue && isGo)
                {
                    if (pack.L4Name != "托")
                    {
                        isGo = false;
                        packLevel = 3;
                        bNum = Convert.ToInt32(pack.L3Num);
                    }
                }
                if (pack.L2Num.HasValue)
                {
                    packLevel = 2;
                    bNum = Convert.ToInt32(pack.L2Num);
                    if (pack.L2Name != "托")
                    {
                        packLevel = 2;
                        bNum = Convert.ToInt32(pack.L2Num);
                    }
                }
                if (pack.L1Num.HasValue)
                {
@@ -633,7 +607,7 @@
                if (packLevel <= 1)//包装等级小于1,按照1级标签打印
                {
                    packLevel = 1;
                    throw new Exception("包装信息有误,小于一级");
                }
                #endregion
@@ -744,12 +718,12 @@
                        //获取箱码
                        if (maxBoxCode == "")
                        {
                            var str = maxLotNoStr + "000001"; //批号+ 流水  2302010001000001
                            var str = "B"+maxLotNoStr + "000001"; //批号+ 流水  2302010001000001
                            maxBoxCode = str;
                        }
                        else
                        {
                            maxBoxCode = maxBoxCode.Substring(0, 10) + (int.Parse(maxBoxCode.Substring(10, 6)) + 1).ToString().PadLeft(6, '0');
                            maxBoxCode = maxBoxCode.Substring(0, 11) + (int.Parse(maxBoxCode.Substring(11, 6)) + 1).ToString().PadLeft(6, '0');
                        } 
                        
                        // 将条码保存到原料条码表
@@ -868,15 +842,34 @@
                    for (int i = 1; i <= labelNum2; i++)//箱码标签
                    {
                        //获取箱码
                        if (maxboxcode2 == "")
                        //箱内数量
                        decimal boxQty = 0;
                        if (i == labelNum2)
                        {
                            maxboxcode2 = maxCodestr2 + "000001"; // 箱号     批号+第几箱
                            // 最后一个条码
                            var s = bNum * (i - 1);
                            if (bNum > qty2 - s)
                            {
                                boxQty = qty2 - s;// 数量
                            }
                            else
                            {
                                boxQty = bNum;// 数量
                            }
                        }
                        else
                        {
                            maxboxcode2 = maxboxcode2.Substring(0, 10) + (int.Parse(maxboxcode2.Substring(10, 6)) + 1).ToString().PadLeft(6, '0');
                            boxQty = bNum;                                                         // 数量
                        }
                        //获取箱码
                        if (maxboxcode2 == "")
                        {
                            maxboxcode2 = "B"+maxCodestr2 + "000001"; // 箱号     批号+第几箱
                        }
                        else
                        {
                            maxboxcode2 = maxboxcode2.Substring(0, 11) + (int.Parse(maxboxcode2.Substring(11, 6)) + 1).ToString().PadLeft(6, '0');
                        }
                        //获取箱内支标签数量
                        if (i == labelNum2)
@@ -888,6 +881,12 @@
                                if (isGo2)
                                {
                                    break;
                                }
                                var s = bNum * (i - 1);
                                var s2 = zNum * (j - 1);
                                if (zNum >= qty2 - s - s2)
                                {
                                    isGo2 = true;
                                }
                                sl++;
                            }
@@ -910,11 +909,11 @@
                            
                            if (maxboxcode3 == "")
                            {
                                maxboxcode3 = maxCodestr2 + "0001"; // 支号     批号+第几箱
                                maxboxcode3 = "Z"+maxCodestr2 + "0001"; // 支号     批号+第几箱
                            }
                            else
                            {
                                maxboxcode3 = maxboxcode3.Substring(0, 28) + (int.Parse(maxboxcode3.Substring(28, 4)) + 1).ToString().PadLeft(4, '0');
                                maxboxcode3 = maxboxcode3.Substring(0, 11) + (int.Parse(maxboxcode3.Substring(11, 4)) + 1).ToString().PadLeft(4, '0');
                            }
                            // 将条码保存到原料条码表
@@ -934,7 +933,7 @@
                                PackageStandard = packStr,
                                SupplierLot = asnList.SupplierLot,
                                InspectMark = "0",
                                BitBoxMark = bNum > d ? "1" : "0",
                                BitBoxMark = bNum > boxQty ? "1" : "0",
                                InspectStatus = "0",
                                ProductionTime = DateTime.Parse(productionTime),
@@ -956,10 +955,10 @@
                    #endregion
                }
                //return labelModel;
                return modelList;
                throw new NotImplementedException();
                //throw new NotImplementedException();
            }
            catch (Exception e)
            {