wxw
2025-10-12 87110c04df904eb4947587a34f3fc5a1eb45eb7e
Wms/WMS.BLL/BllAsnServer/ArrivalNoticeServer.cs
@@ -275,7 +275,7 @@
            try
            {
                if (model.Origin == "录入")
                if (model.Origin == "录入" || model.Origin == "导入")
                {
                    model.ASNNo = new Common().GetMaxNo("ASN");
                }
@@ -290,6 +290,7 @@
                        throw new Exception("单据类型不可为空!");
                    }
                }
                
                lock (AsnLock)
                {
@@ -422,12 +423,16 @@
                            {
                                throw new Exception("不免检物料过期日期转换失败");
                            }
                            lot1 = lot12.ToString();
                            lot2 = lot22.ToString();
                            lot1 = lot12.ToString("yyyy-MM-dd");
                            lot2 = lot22.ToString("yyyy-MM-dd");
                        }
                        if (string.IsNullOrWhiteSpace(detailModel.PackagNo))
                        {
                            throw new Exception("包装不能为空");
                            detailModel.PackagNo = sku.PackagNo;
                            if (string.IsNullOrWhiteSpace(detailModel.PackagNo))
                            {
                                throw new Exception("包装不能为空");
                            }
                        }
                        // 计算出总金额
                        detailModel.Money = detailModel.Price * detailModel.Qty;
@@ -436,7 +441,7 @@
                            ASNNo = model.ASNNo,
                            SkuNo = detailModel.SkuNo,
                            SkuName = detailModel.SkuName,
                            Standard = detailModel.Standard,
                            Standard = sku.Standard,
                            LotNo = detailModel.LotNo == null ? "" : detailModel.LotNo.Trim(),
                            LotText = detailModel.LotText,
                            Qty = (decimal)detailModel.Qty,
@@ -500,6 +505,63 @@
            }
        }
        //导入入库单据
        public string ImportArrivalNotice(ArrivalNoticeVms models)
        {
            string strMessage = "";
            try
            {
                if (models.ListArrivalNotice.Count <= 0)
                {
                    strMessage = "-1:文件内无数据请核实!";
                }
                var num = 0;
                int CreateUser = Convert.ToInt32(models.CreateUser);
                List<string> noticeList = new List<string>();
                foreach (ArrivalNoticeVm model in models.ListArrivalNotice)
                {
                    try
                    {
                        model.CreateUser = models.CreateUser;
                        model.Origin = "导入";
                        var msg = AddArrivalNotice(model);
                        strMessage += msg;
                        if (msg == "")
                        {
                            num += 1;
                            var hasBoxItem = noticeList.Exists(x => x == model.ASNNo);
                            if (!hasBoxItem)
                            {
                                noticeList.Add(model.ASNNo);
                            }
                        }
                    }
                    catch
                    {
                        // ignored
                    }
                }
                if (num > 0)
                {
                    new OperationASNServer().AddLogOperationAsn("入库作业", "入库单据", $"共导入了{noticeList.Count}条单据", "导入", $"共导入了{noticeList.Count}条单据", CreateUser);
                }
                if (strMessage.Contains("-1") && num > 0)
                {
                    return "部分导入成功" + strMessage;
                }
                if (num > 0)
                {
                    return "导入成功" + strMessage;
                }
                return strMessage;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        /// 编辑入库单据
        /// </summary>