解决冲突

This commit is contained in:
yang.lee
2023-12-12 14:29:34 +08:00
5 changed files with 246 additions and 5 deletions

View File

@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
{
public class SaleReturnInput
{
/// <summary>
/// 入库仓库ID
/// </summary>
public string? warehouse { get; set; }
/// <summary>
/// 供应商代码
/// </summary>
public string? supplier_code { get; set; }
/// <summary>
/// 打印状态
/// </summary>
public string print_status { get; set; } = string.Empty;
/// <summary>
/// 库位
/// </summary>
public string? location { get; set; }
/// <summary>
/// 来源单据ID
/// </summary>
public string? source_id { get; set; }
/// <summary>
/// 来源单据代码
/// </summary>
public string? source_code { get; set; }
/// <summary>
/// 源单单据类型
/// </summary>
public int? source_type { get; set; }
/// <summary>
/// 来源单据行号
/// </summary>
public int? source_line { get; set; }
/// <summary>
/// 来源单据明细ID
/// </summary>
public string? source_detail_id { get; set; }
/// <summary>
/// 采购单号
/// </summary>
public string purchase_code { get; set; }
public List<SaleReturnDetail> details { get; set; }
}
public class SaleReturnDetail
{
/// <summary>
/// 物品代码
/// </summary>
public string material_code { get; set; } = string.Empty;
/// <summary>
/// 入库需求数量
/// </summary>
public decimal? pr_qty { get; set; }
/// <summary>
/// 实际入库数量
/// </summary>
public decimal qty { get; set; }
/// <summary>
/// 原因
/// </summary>
public string? reason { get; set; }
/// <summary>
/// 入库仓库ID
/// </summary>
public string? warehouse { get; set; }
/// <summary>
/// 不含税单价
/// </summary>
public decimal? price { get; set; }
/// <summary>
/// 含税单价
/// </summary>
public decimal? tax_price { get; set; }
/// <summary>
/// 不含税金额
/// </summary>
public decimal? amount { get; set; }
/// <summary>
/// 含税金额
/// </summary>
public decimal? all_amount { get; set; }
/// <summary>
/// 已打印数量
/// </summary>
public decimal print_qty { get; set; }
/// <summary>
/// 扫描数量
/// </summary>
public decimal scan_qty { get; set; }
/// <summary>
/// 批次
/// </summary>
public string? code_batch { get; set; }
/// <summary>
/// 箱号
/// </summary>
public string? container_no { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
{
public class CheckPutInput
{
public string point_code { get; set; }
}
}

View File

@@ -208,5 +208,75 @@ namespace Tnb.WarehouseMgr
await db.Insertable(WmsSaleH).ExecuteCommandAsync();
await db.Insertable(WmsSaleDs).ExecuteCommandAsync();
}
/// <summary>
/// 销售退货单
/// </summary>
public async Task SaleReturn(SaleReturnInput input)
{
var db = _repository.AsSugarClient();
WmsInstockH WmsInstockH = new WmsInstockH();
string Code = await _billRuleService.GetBillNumber("WmsInStock");
WmsInstockH.bill_code = Code;
WmsInstockH.bill_date = DateTime.Now;
WmsInstockH.bill_type = "25103434001429";//销售退货单
WmsInstockH.biz_type = "26191496816421";//一般入库
WmsInstockH.status = "25065138925589";//新增
WmsInstockH.generate_type = "1";//0人工 1自动
WmsInstockH.create_time = DateTime.Now;
WmsInstockH.source_id = input.source_id;
WmsInstockH.source_code = input.source_code;
WmsInstockH.source_line = input.source_line;
WmsInstockH.source_detail_id = input.source_detail_id;
WmsInstockH.is_check = 1;
WmsInstockH.purchase_code = input.purchase_code;
WmsInstockH.sync_status = "26191359047461";//无需同步
WmsInstockH.print_status = "26191366982437";//未打印
WmsInstockH.create_id = "";
WmsInstockH.create_time = DateTime.Now;
var location = await db.Queryable<BasLocation>().Where(p => p.location_code == input.location).FirstAsync();
if (location != null)
WmsInstockH.location_id = location.id;
var warehouse = await db.Queryable<BasWarehouse>().Where(p => p.whcode == input.warehouse).FirstAsync();
if (warehouse != null)
WmsInstockH.warehouse_id = warehouse.id;
WmsInstockH.supplier_code = input.supplier_code;
var supplier = await db.Queryable<BasSupplier>().Where(p => p.supplier_code == input.supplier_code).FirstAsync();
if (supplier != null)
{
WmsInstockH.supplier_id = supplier.id;
WmsInstockH.supplier_name = supplier.supplier_name;
}
List<WmsInstockD> WmsInstockDs = new List<WmsInstockD>();
foreach (var detail in input.details)
{
WmsInstockD WmsInstockD = new WmsInstockD();
WmsInstockD.bill_id = WmsInstockH.id;
WmsInstockD.line_status = "25065138925589";//新增
WmsInstockD.pr_qty = detail.pr_qty;
WmsInstockD.qty = detail.qty;
WmsInstockD.reason = detail.reason;
WmsInstockD.price = detail.price;
WmsInstockD.tax_price = detail.tax_price;
WmsInstockD.amount = detail.amount;
WmsInstockD.all_amount = detail.all_amount;
WmsInstockD.print_qty = 0;
WmsInstockD.scan_qty = 0;
WmsInstockD.code_batch = detail.code_batch;
WmsInstockD.container_no = detail.container_no;
var detailwarehouse = await db.Queryable<BasWarehouse>().Where(p => p.whcode == input.warehouse).FirstAsync();
if (detailwarehouse != null)
WmsInstockD.warehouse_id = detailwarehouse.id;
var material = await db.Queryable<BasMaterial>().Where(p => p.code == detail.material_code).FirstAsync();
if (material != null)
{
WmsInstockD.material_id = material.id;
WmsInstockD.unit_id = material.unit_id;
}
WmsInstockDs.Add(WmsInstockD);
}
await db.Insertable(WmsInstockH).ExecuteCommandAsync();
await db.Insertable(WmsInstockDs).ExecuteCommandAsync();
}
}
}

View File

@@ -44,11 +44,11 @@ namespace Tnb.WarehouseMgr
//遍历字典,找出需要查询数据库拿的相关字段
foreach (Dictionary<string, object> d in dics)
{
{ /*
if (d.Select(x => x.Value.ToString()).ToList().Find(v => v != "" && v != string.Empty && v != null) == null)
{
continue;
}
}*/
string LCode = d["location_code"]?.ToString() ?? string.Empty;
if (LCode == string.Empty)
{
@@ -134,13 +134,14 @@ namespace Tnb.WarehouseMgr
{
row = await _db.Fastest<BasLocation>().BulkCopyAsync(locs);
}
/*
else if (locs.Count > 400)
{
_db.Utilities.PageEach(locs, 100, async pageList =>
{
row = await _db.Insertable(pageList).ExecuteCommandAsync();
});
}
}*/
else
{
row = await _db.Insertable(locs).ExecuteCommandAsync();

View File

@@ -12,13 +12,16 @@ using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.OpenXmlFormats.Dml;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.Common.Extension;
using Tnb.Common.Redis;
using Tnb.Common.Utils;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Configs;
@@ -63,8 +66,6 @@ namespace Tnb.WarehouseMgr
_elevatorControlService = elevatorControlService;
//_configuration = configuration;
}
/// <summary>
/// 根据载具Id带出库位、仓库信息
/// </summary>
@@ -228,6 +229,31 @@ namespace Tnb.WarehouseMgr
.ToListAsync();
return input.Size > 0 ? items.Take(input.Size).ToList() : items;
}
/// <summary>
/// 判断CTU是否可以放货
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task CheckPut(CheckPutInput input)
{
Dictionary<string, string[]> dic = new Dictionary<string, string[]>();
dic.Add("5号输送线点位", new string[] { "TY4C-ZHUSU1", "weighDone_5" });
dic.Add("6号输送线点位", new string[] { "TY4C-ZHUSU1", "weighDone_6" });
if (!dic.ContainsKey(input.point_code))
throw new AppFriendlyException("点位" + input.point_code + "不存在", 500);
var strs = dic.Where(p => p.Key == input.point_code).First().Value;
bool flag = await _redisData.HashExist(strs[0], strs[1]);
if (!flag)
{
throw new AppFriendlyException("点位" + input.point_code + "不存在", 500);
}
string data = await _redisData.GetHash(strs[0], strs[1]);
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
if (!result)
throw new AppFriendlyException("点位" + input.point_code + "不可放", 500);
}
/// <summary>
/// 生成任务执行
/// </summary>