|
|
@@ -460,6 +460,7 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
Dictionary<string, object> Obj = new Dictionary<string, object>();
|
|
|
List<Dictionary<string, object>> dataList = new List<Dictionary<string, object>>();
|
|
|
List<SendInfo> sendInfos = new List<SendInfo>();
|
|
|
+ List<CheckSendInfo> checksendInfos = new List<CheckSendInfo>();
|
|
|
StoreMachineApply apply = db.StoreMachineApply.FirstOrDefault(m => m.Id == data.Id) ?? new StoreMachineApply();
|
|
|
JsonData ApplyList = JsonMapper.ToObject(apply.SendSn);
|
|
|
decimal ApplyAmount = 0;
|
|
|
@@ -492,6 +493,76 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
}
|
|
|
ExcelData = HttpUtility.UrlDecode(ExcelData);
|
|
|
JsonData list = JsonMapper.ToObject(ExcelData);
|
|
|
+
|
|
|
+ //判断各品牌发货数量是否符合
|
|
|
+ if (list.Count - 1 > apply.ApplyNum)
|
|
|
+ {
|
|
|
+ return "Warning|" + "机具发货数量过多!";
|
|
|
+ }
|
|
|
+ if (list.Count - 1 < apply.ApplyNum)
|
|
|
+ {
|
|
|
+ return "Warning|" + "机具发货数量不足!";
|
|
|
+ }
|
|
|
+ for (int index = 1; index < list.Count; index++)
|
|
|
+ {
|
|
|
+ JsonData dr = list[index];
|
|
|
+ string itemJson = dr.ToJson();
|
|
|
+ string SnNo = itemJson.Contains("\"A\"") ? dr["A"].ToString() : "";
|
|
|
+ string Brand = itemJson.Contains("\"B\"") ? dr["B"].ToString() : "";
|
|
|
+ string BatchNo = itemJson.Contains("\"C\"") ? dr["C"].ToString() : "";
|
|
|
+ string OutNote = itemJson.Contains("\"D\"") ? dr["D"].ToString() : "";
|
|
|
+
|
|
|
+ BrandId = Convert.ToInt32(Brand);
|
|
|
+
|
|
|
+ if (BrandId == 1) FromStoreId = 7;
|
|
|
+ if (BrandId == 2) FromStoreId = 721;
|
|
|
+ if (BrandId == 3) FromStoreId = 697;
|
|
|
+ if (BrandId == 4) FromStoreId = 774;
|
|
|
+ if (BrandId == 5) FromStoreId = 775;
|
|
|
+ if (BrandId == 6) FromStoreId = 871;
|
|
|
+ if (BrandId == 7) FromStoreId = 1047;
|
|
|
+ if (BrandId == 8) FromStoreId = 4831;
|
|
|
+ if (BrandId == 9) FromStoreId = 4832;
|
|
|
+ CheckSendInfo items = checksendInfos.FirstOrDefault(m => m.BrandId == BrandId);
|
|
|
+ if (items == null)
|
|
|
+ {
|
|
|
+ CheckSendInfo rows = new CheckSendInfo()
|
|
|
+ {
|
|
|
+ BrandId = BrandId,
|
|
|
+ Num = 1
|
|
|
+ };
|
|
|
+ checksendInfos.Add(rows);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ items.Num += 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (int i = 0; i < ApplyList.Count; i++)
|
|
|
+ {
|
|
|
+ int num = Convert.ToInt32(ApplyList[i]["ApplyNum"].ToString());
|
|
|
+ int BrandIds = Convert.ToInt32(ApplyList[i]["BrandId"].ToString());
|
|
|
+ if (BrandIds == 1) FromStoreId = 7;
|
|
|
+ if (BrandIds == 2) FromStoreId = 721;
|
|
|
+ if (BrandIds == 3) FromStoreId = 697;
|
|
|
+ if (BrandIds == 4) FromStoreId = 774;
|
|
|
+ if (BrandIds == 5) FromStoreId = 775;
|
|
|
+ if (BrandIds == 6) FromStoreId = 871;
|
|
|
+ if (BrandIds == 7) FromStoreId = 1047;
|
|
|
+ if (BrandIds == 8) FromStoreId = 4831;
|
|
|
+ if (BrandIds == 9) FromStoreId = 4832;
|
|
|
+ var brandInfo = db.KqProducts.FirstOrDefault(m => m.Id == BrandIds);
|
|
|
+ CheckSendInfo items = checksendInfos.FirstOrDefault(m => m.BrandId == BrandIds) ?? new CheckSendInfo();
|
|
|
+ if (items.Num > num)
|
|
|
+ {
|
|
|
+ return "Warning|" + "该条发货记录的" + brandInfo.Name + "发货数量过多!";
|
|
|
+ }
|
|
|
+ if (items.Num < num)
|
|
|
+ {
|
|
|
+ return "Warning|" + "该条发货记录的" + brandInfo.Name + "发货数量不足!";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
List<string> PosSnList = new List<string>();
|
|
|
for (int index = 1; index < list.Count; index++)
|
|
|
{
|
|
|
@@ -658,7 +729,6 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
{
|
|
|
return "总仓无该机具";
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
foreach (var item in sendInfos)
|
|
|
@@ -743,5 +813,12 @@ namespace MySystem.Areas.Admin.Controllers
|
|
|
public int Num { get; set; }
|
|
|
}
|
|
|
|
|
|
+ //检查发货信息实体类
|
|
|
+ private class CheckSendInfo
|
|
|
+ {
|
|
|
+ public int BrandId { get; set; }
|
|
|
+ public int Num { get; set; }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|