Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -0,0 +1,370 @@
|
||||
namespace Tnb.BasicData.Entities.Dto
|
||||
{
|
||||
public class ErpBasMaterialInput
|
||||
{
|
||||
public ErpBasMaterial bas_material { get; set; }
|
||||
public List<ErpBasMaterialUnit> bas_material_units { get; set; } = new List<ErpBasMaterialUnit>();
|
||||
|
||||
// public List<ErpBasMaterialIntoFactorySpecifications> bas_material_into_factory_specificationses { get; set; } = new List<ErpBasMaterialIntoFactorySpecifications>();
|
||||
//
|
||||
// public List<ErpBasSubstitutionMaterial> bas_substitution_materials { get; set; } = new List<ErpBasSubstitutionMaterial>();
|
||||
//
|
||||
// public List<ErpBasMaterialSendWarehouse> bas_material_send_warehouses { get; set; } = new List<ErpBasMaterialSendWarehouse>();
|
||||
//
|
||||
// public List<ErpBasMaterialInboundWh> bas_material_inbound_whs { get; set; } = new List<ErpBasMaterialInboundWh>();
|
||||
}
|
||||
|
||||
public class ErpBasMaterial
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料代码
|
||||
/// </summary>
|
||||
public string code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料名称
|
||||
/// </summary>
|
||||
public string name { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 物料分类ID
|
||||
/// </summary>
|
||||
public string category_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 单位ID
|
||||
/// </summary>
|
||||
public string unit_id { get; set; } = string.Empty;
|
||||
|
||||
// /// <summary>
|
||||
// /// 单价
|
||||
// /// </summary>
|
||||
// public decimal? cost { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 毛重
|
||||
// /// </summary>
|
||||
// public decimal? grossweight { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 净重
|
||||
// /// </summary>
|
||||
// public decimal? netweight { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 长
|
||||
// /// </summary>
|
||||
// public decimal? length { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 宽
|
||||
// /// </summary>
|
||||
// public decimal? width { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 高
|
||||
// /// </summary>
|
||||
// public decimal? high { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 体积
|
||||
// /// </summary>
|
||||
// public decimal? volumn { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// 是否免检
|
||||
// /// </summary>
|
||||
// public int? isexemption { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 安全库存
|
||||
/// </summary>
|
||||
public decimal? safeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保质期
|
||||
/// </summary>
|
||||
public int? qualityperiod { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 是否过期允许出库
|
||||
// /// </summary>
|
||||
// public string? expireout { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小包装
|
||||
/// </summary>
|
||||
public decimal? minpacking { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否先进先出管控
|
||||
/// </summary>
|
||||
public string? fifo { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 先进先出间隔天数,批次间隔天数
|
||||
// /// </summary>
|
||||
// public int? fifo_interval_days { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料规格型号
|
||||
/// </summary>
|
||||
public string? material_standard { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 海关编码
|
||||
// /// </summary>
|
||||
// public string? fhscode { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 附属性
|
||||
// /// </summary>
|
||||
// public string? attribute { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 管控类型: 批管控:Lot 单管控:KeyParts 非管控:NoControl
|
||||
// /// </summary>
|
||||
// public string? controltype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? remark { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 创建用户
|
||||
// /// </summary>
|
||||
// public string? create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_count { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 修改用户
|
||||
// /// </summary>
|
||||
// public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
public string? modify_count { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 扩展字段
|
||||
// /// </summary>
|
||||
// public string? extras { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public string? state { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物料属性
|
||||
/// </summary>
|
||||
public string? material_property { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签
|
||||
/// </summary>
|
||||
public string? label { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string? descrip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次管理
|
||||
/// </summary>
|
||||
public int? is_batch_enabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标签管理
|
||||
/// </summary>
|
||||
public int? is_label_enabled { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// 附件
|
||||
// /// </summary>
|
||||
// public string? attachment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 先进先出 0否 1是
|
||||
/// </summary>
|
||||
public int? first_in_out { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 存储有效期(天)
|
||||
/// </summary>
|
||||
public int? storage_valid_day { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预警提前期(天)
|
||||
/// </summary>
|
||||
public int? early_warn_day { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 安全库存
|
||||
/// </summary>
|
||||
public int? safe_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 安全库存包含状态
|
||||
/// </summary>
|
||||
public string? safe_stock_stauts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发料仓库id
|
||||
/// </summary>
|
||||
public string? send_warehouse_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 入厂单位id
|
||||
/// </summary>
|
||||
public string? into_factory_unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 投料单位
|
||||
/// </summary>
|
||||
public string? material_in_unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产出单位
|
||||
/// </summary>
|
||||
public string? material_out_unit_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请料方式 1按计划排程请料 2自行管控
|
||||
/// </summary>
|
||||
public string? material_request_method { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否包含入库数
|
||||
/// </summary>
|
||||
public int? is_contain_into_num { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否创建子工单
|
||||
/// </summary>
|
||||
public string? is_create_sub_work_order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 保质期
|
||||
/// </summary>
|
||||
public int? quality_guarantee_period { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DI编码
|
||||
/// </summary>
|
||||
public string? di { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ErpBasMaterialUnit
|
||||
{
|
||||
/// <summary>
|
||||
/// 主单位数量
|
||||
/// </summary>
|
||||
public string? number_of_primary_unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 辅助单位数量
|
||||
/// </summary>
|
||||
public string? number_of_auxiliary_unit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 辅助单位
|
||||
/// </summary>
|
||||
public string auxiliary_unit_id { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
public class ErpBasMaterialIntoFactorySpecifications
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位id
|
||||
/// </summary>
|
||||
public string unit_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public decimal num { get; set; }
|
||||
}
|
||||
|
||||
public class ErpBasSubstitutionMaterial
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 替代料编号
|
||||
/// </summary>
|
||||
public string sub_material_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 替代比例,如1(一个物料可以用一个替代料代替)
|
||||
/// </summary>
|
||||
public decimal proportion { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ErpBasMaterialSendWarehouse
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 仓库编号
|
||||
/// </summary>
|
||||
public string? wh_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大库存
|
||||
/// </summary>
|
||||
public int? max_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小库存
|
||||
/// </summary>
|
||||
public int? min_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 安全库存
|
||||
/// </summary>
|
||||
public int? safe_stock { get; set; }
|
||||
}
|
||||
|
||||
public class ErpBasMaterialInboundWh
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 仓库编号
|
||||
/// </summary>
|
||||
public string? wh_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大库存
|
||||
/// </summary>
|
||||
public int? max_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最小库存
|
||||
/// </summary>
|
||||
public int? min_stock { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 安全库存
|
||||
/// </summary>
|
||||
public int? safe_stock { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -264,4 +264,9 @@ public partial class BasMaterial : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string? di { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标志
|
||||
/// </summary>
|
||||
public int? deleted { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ using SqlSugar;
|
||||
namespace Tnb.BasicData.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 物料入场规格
|
||||
/// 物料入厂规格
|
||||
/// </summary>
|
||||
[SugarTable("bas_material_into_factory_specifications")]
|
||||
public partial class BasMaterialIntoFactorySpecifications : BaseEntity<string>
|
||||
|
||||
@@ -6,10 +6,13 @@ using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SQLitePCL;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
@@ -275,5 +278,185 @@ namespace Tnb.BasicData
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 物料新增修改接口
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> CreateCreateOrUpdateMaterial(ErpBasMaterialInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
if (input == null)
|
||||
{
|
||||
throw Oops.Bah("参数为空");
|
||||
}
|
||||
if (input.bas_material == null)
|
||||
{
|
||||
throw Oops.Bah("物料信息为空");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.bas_material.code))
|
||||
{
|
||||
throw Oops.Bah("物料编号为空");
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.bas_material.name))
|
||||
{
|
||||
throw Oops.Bah("物料名称为空");
|
||||
}
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
BasMaterial basMaterial = input.bas_material.Adapt<BasMaterial>();
|
||||
if (!await db.Queryable<BasMaterial>().AnyAsync(x => x.code == input.bas_material.code))
|
||||
{
|
||||
basMaterial.id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(input.bas_material.create_count))
|
||||
{
|
||||
UserEntity userEntity = await db.Queryable<UserEntity>().FirstAsync(x=>x.Account==input.bas_material.create_count);
|
||||
if (userEntity == null)
|
||||
{
|
||||
throw Oops.Bah($"未找到用户{input.bas_material.create_count}");
|
||||
}
|
||||
basMaterial.create_id = userEntity?.Id;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(input.bas_material.modify_count))
|
||||
{
|
||||
UserEntity userEntity = await db.Queryable<UserEntity>().FirstAsync(x=>x.Account==input.bas_material.modify_count);
|
||||
if (userEntity == null)
|
||||
{
|
||||
throw Oops.Bah($"未找到用户{input.bas_material.modify_count}");
|
||||
}
|
||||
basMaterial.modify_id = userEntity?.Id;
|
||||
}
|
||||
|
||||
List<BasMaterialUnit> basMaterialUnits = new List<BasMaterialUnit>();
|
||||
// List<BasMaterialIntoFactorySpecifications> basMaterialIntoFactorySpecificationsList = new List<BasMaterialIntoFactorySpecifications>();
|
||||
// List<BasSubstitutionMaterial> basSubstitutionMaterials = new List<BasSubstitutionMaterial>();
|
||||
// List<BasMaterialSendWarehouse> basMaterialSendWarehouses = new List<BasMaterialSendWarehouse>();
|
||||
// List<BasMaterialInboundWh> basMaterialInboundWhs = new List<BasMaterialInboundWh>();
|
||||
|
||||
if (input.bas_material_units != null && input.bas_material_units.Count > 0)
|
||||
{
|
||||
foreach(var item in input.bas_material_units)
|
||||
{
|
||||
BasMaterialUnit basMaterialUnit = item.Adapt<BasMaterialUnit>();
|
||||
basMaterialUnit.id = SnowflakeIdHelper.NextId();
|
||||
basMaterialUnit.material_id = basMaterial.id;
|
||||
basMaterialUnits.Add(basMaterialUnit);
|
||||
}
|
||||
}
|
||||
|
||||
// if (input.bas_material_into_factory_specificationses != null && input.bas_material_into_factory_specificationses.Count > 0)
|
||||
// {
|
||||
// foreach(var item in input.bas_material_into_factory_specificationses)
|
||||
// {
|
||||
// BasMaterialIntoFactorySpecifications basMaterialIntoFactorySpecifications = item.Adapt<BasMaterialIntoFactorySpecifications>();
|
||||
// basMaterialIntoFactorySpecifications.id = SnowflakeIdHelper.NextId();
|
||||
// basMaterialIntoFactorySpecifications.material_id = basMaterial.id;
|
||||
// basMaterialIntoFactorySpecificationsList.Add(basMaterialIntoFactorySpecifications);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (input.bas_substitution_materials != null && input.bas_substitution_materials.Count > 0)
|
||||
// {
|
||||
// foreach(var item in input.bas_substitution_materials)
|
||||
// {
|
||||
// BasSubstitutionMaterial basSubstitutionMaterial = item.Adapt<BasSubstitutionMaterial>();
|
||||
// basSubstitutionMaterial.id = SnowflakeIdHelper.NextId();
|
||||
// basSubstitutionMaterial.material_id = basMaterial.id;
|
||||
// BasMaterial subBasMaterial = await db.Queryable<BasMaterial>().FirstAsync(x=>x.code==item.sub_material_code);
|
||||
// if (subBasMaterial == null)
|
||||
// {
|
||||
// throw Oops.Bah($"未找到替代物料{item.sub_material_code}");
|
||||
// }
|
||||
// basSubstitutionMaterial.sub_material_id = subBasMaterial?.id ?? item.sub_material_code;
|
||||
// basSubstitutionMaterials.Add(basSubstitutionMaterial);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (input.bas_material_send_warehouses != null && input.bas_material_send_warehouses.Count > 0)
|
||||
// {
|
||||
// foreach(var item in input.bas_material_send_warehouses)
|
||||
// {
|
||||
// BasMaterialSendWarehouse basMaterialSendWarehouse = item.Adapt<BasMaterialSendWarehouse>();
|
||||
// basMaterialSendWarehouse.id = SnowflakeIdHelper.NextId();
|
||||
// basMaterialSendWarehouse.material_id = basMaterial.id;
|
||||
// BasWarehouse basWarehouse = await db.Queryable<BasWarehouse>().FirstAsync(x=>x.whcode==item.wh_code);
|
||||
// if (basWarehouse == null)
|
||||
// {
|
||||
// throw Oops.Bah($"发料仓库未找到仓库{item.wh_code}");
|
||||
// }
|
||||
// basMaterialSendWarehouse.wh_id = basWarehouse?.id ?? item.wh_code;
|
||||
// basMaterialSendWarehouses.Add(basMaterialSendWarehouse);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (input.bas_material_inbound_whs != null && input.bas_material_inbound_whs.Count > 0)
|
||||
// {
|
||||
// foreach(var item in input.bas_material_inbound_whs)
|
||||
// {
|
||||
// BasMaterialInboundWh basMaterialInboundWh = item.Adapt<BasMaterialInboundWh>();
|
||||
// basMaterialInboundWh.id = SnowflakeIdHelper.NextId();
|
||||
// basMaterialInboundWh.material_id = basMaterial.id;
|
||||
// BasWarehouse basWarehouse = await db.Queryable<BasWarehouse>().FirstAsync(x=>x.whcode==item.wh_code);
|
||||
// if (basWarehouse == null)
|
||||
// {
|
||||
// throw Oops.Bah($"入库仓库未找到仓库{item.wh_code}");
|
||||
// }
|
||||
// basMaterialInboundWh.wh_id = basWarehouse?.id ?? item.wh_code;
|
||||
// basMaterialInboundWhs.Add(basMaterialInboundWh);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (!await db.Queryable<BasMaterial>().AnyAsync(x => x.code == input.bas_material.code))
|
||||
{
|
||||
await db.Insertable<BasMaterial>(basMaterial).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await db.Updateable<BasMaterial>(basMaterial).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
// var x= await db.Storageable(basMaterial).ToStorageAsync();
|
||||
// await x.AsInsertable.ExecuteCommandAsync();//不存在插入
|
||||
// await x.AsUpdateable.ExecuteCommandAsync();//存在更新
|
||||
|
||||
if (basMaterialUnits.Count > 0)
|
||||
{
|
||||
await db.Deleteable<BasMaterialUnit>().Where(x=>x.material_id==basMaterial.id).ExecuteCommandAsync();
|
||||
await db.Insertable<BasMaterialUnit>(basMaterialUnits).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
// if (basMaterialIntoFactorySpecificationsList.Count > 0)
|
||||
// {
|
||||
// await db.Deleteable<BasMaterialIntoFactorySpecifications>().Where(x=>x.material_id==basMaterial.id).ExecuteCommandAsync();
|
||||
// await db.Insertable<BasMaterialIntoFactorySpecifications>(basMaterialIntoFactorySpecificationsList).ExecuteCommandAsync();
|
||||
// }
|
||||
//
|
||||
// if (basSubstitutionMaterials.Count > 0)
|
||||
// {
|
||||
// await db.Deleteable<BasSubstitutionMaterial>().Where(x=>x.material_id==basMaterial.id).ExecuteCommandAsync();
|
||||
// await db.Insertable<BasSubstitutionMaterial>(basSubstitutionMaterials).ExecuteCommandAsync();
|
||||
// }
|
||||
//
|
||||
// if (basMaterialSendWarehouses.Count > 0)
|
||||
// {
|
||||
// await db.Deleteable<BasMaterialSendWarehouse>().Where(x=>x.material_id==basMaterial.id).ExecuteCommandAsync();
|
||||
// await db.Insertable<BasMaterialSendWarehouse>(basMaterialSendWarehouses).ExecuteCommandAsync();
|
||||
// }
|
||||
//
|
||||
// if (basMaterialInboundWhs.Count > 0)
|
||||
// {
|
||||
// await db.Deleteable<BasMaterialInboundWh>().Where(x=>x.material_id==basMaterial.id).ExecuteCommandAsync();
|
||||
// await db.Insertable<BasMaterialInboundWh>(basMaterialInboundWhs).ExecuteCommandAsync();
|
||||
// }
|
||||
|
||||
});
|
||||
return !result.IsSuccess ? throw Oops.Oh(result.ErrorMessage) : "保存成功";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -288,6 +288,7 @@ namespace Tnb.ProductionMgr
|
||||
.SetColumns(x => x.repair_id == _userManager.UserId)
|
||||
.SetColumns(x=>x.status==DictConst.AndonStatusYXY)
|
||||
.SetColumns(x => x.response_time == DateTime.Now)
|
||||
.Where(x => x.id == id)
|
||||
.ExecuteCommandAsync();
|
||||
Dictionary<string, string> postData = new()
|
||||
{
|
||||
@@ -394,7 +395,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else
|
||||
{
|
||||
if (andonRecords.status != DictConst.AndonStatusYWC)
|
||||
if (andonRecords.status != DictConst.AndonStatusDQR)
|
||||
{
|
||||
throw Oops.Bah($"状态错误");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
||||
{
|
||||
public class AllotInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 起始库位ID
|
||||
/// </summary>
|
||||
public string startlocation { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 目标库位ID
|
||||
/// </summary>
|
||||
public string endlocation { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 单据状态
|
||||
/// </summary>
|
||||
public string status { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 业务类型:
|
||||
/// </summary>
|
||||
public string biz_type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 所属仓库
|
||||
/// </summary>
|
||||
public string warehouse { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
||||
{
|
||||
public class PurchaseArriveInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 入库仓库
|
||||
/// </summary>
|
||||
public string? warehouse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商代码
|
||||
/// </summary>
|
||||
public string? supplier_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据ID
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据代码
|
||||
/// </summary>
|
||||
public string? source_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供货日期
|
||||
/// </summary>
|
||||
public DateTime delivery_date { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 运输方式
|
||||
/// </summary>
|
||||
public string? shipping_method { get; set; }
|
||||
public List<PurchaseArriveDetail> details { get; set; }
|
||||
}
|
||||
public class PurchaseArriveDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 物品代码
|
||||
/// </summary>
|
||||
public string material_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 采购数量
|
||||
/// </summary>
|
||||
public decimal purchase_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 已到货数量
|
||||
/// </summary>
|
||||
public decimal purchase_prqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? code_batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 本次到货数量
|
||||
/// </summary>
|
||||
public decimal purchase_arriveqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱号
|
||||
/// </summary>
|
||||
public string? container_no { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
||||
{
|
||||
public class PurchaseReturnInput
|
||||
{ /// <summary>
|
||||
/// 入库仓库
|
||||
/// </summary>
|
||||
public string? warehouse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供应商代码
|
||||
/// </summary>
|
||||
public string? supplier_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据ID
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据代码
|
||||
/// </summary>
|
||||
public string? source_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供货日期
|
||||
/// </summary>
|
||||
public DateTime delivery_date { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 运输方式
|
||||
/// </summary>
|
||||
public string? shipping_method { get; set; }
|
||||
public List<PurchaseReturnDetail> details { get; set; }
|
||||
}
|
||||
public class PurchaseReturnDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 物品代码
|
||||
/// </summary>
|
||||
public string material_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 采购数量
|
||||
/// </summary>
|
||||
public decimal purchase_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 已到货数量
|
||||
/// </summary>
|
||||
public decimal purchase_prqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? code_batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 本次到货数量
|
||||
/// </summary>
|
||||
public decimal purchase_arriveqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱号
|
||||
/// </summary>
|
||||
public string? container_no { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Org.BouncyCastle.Crypto;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Dto.ErpInputs
|
||||
{
|
||||
public class SaleOutInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 仓库
|
||||
/// </summary>
|
||||
public string? warehouse { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户代码
|
||||
/// </summary>
|
||||
public string? customer_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据ID
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据代码
|
||||
/// </summary>
|
||||
public string? source_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 供货日期
|
||||
/// </summary>
|
||||
public DateTime ship_date { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 运输方式
|
||||
/// </summary>
|
||||
public string? shipping_method { get; set; }
|
||||
|
||||
public List<SaleOutDetail> details { get; set; }
|
||||
}
|
||||
public class SaleOutDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 物品代码
|
||||
/// </summary>
|
||||
public string material_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? code_batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱号
|
||||
/// </summary>
|
||||
public string? container_no { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 本次发货数量
|
||||
/// </summary>
|
||||
public decimal purchase_arriveqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///已 发货数量
|
||||
/// </summary>
|
||||
public decimal purchase_prqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发货数量
|
||||
/// </summary>
|
||||
public decimal purchase_qty { get; set; }
|
||||
}
|
||||
}
|
||||
115
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsAllot.cs
Normal file
115
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsAllot.cs
Normal file
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 库内转移
|
||||
/// </summary>
|
||||
[SugarTable("wms_allot")]
|
||||
public partial class WmsAllot : BaseEntity<string>
|
||||
{
|
||||
public WmsAllot()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 租户ID
|
||||
/// </summary>
|
||||
public string? tenant_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属组织ID
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 起始库位ID
|
||||
/// </summary>
|
||||
public string startlocation_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 目标库位ID
|
||||
/// </summary>
|
||||
public string endlocation_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 单号
|
||||
/// </summary>
|
||||
public string bill_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 单据状态
|
||||
/// </summary>
|
||||
public string status { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 业务类型:
|
||||
/// </summary>
|
||||
public string biz_type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 载具ID
|
||||
/// </summary>
|
||||
public string carry_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string carry_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 所属仓库
|
||||
/// </summary>
|
||||
public string warehouse_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string create_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime create_time { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改人员ID
|
||||
/// </summary>
|
||||
public string? modify_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扩展字段
|
||||
/// </summary>
|
||||
public string? extras { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳(用于并发控制)
|
||||
/// </summary>
|
||||
public DateTime? timestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程任务Id
|
||||
/// </summary>
|
||||
public string? f_flowtaskid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 流程引擎Id
|
||||
/// </summary>
|
||||
public string? f_flowid { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
212
WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs
Normal file
212
WarehouseMgr/Tnb.WarehouseMgr/ErpToWmsService.cs
Normal file
@@ -0,0 +1,212 @@
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.ErpInputs;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// erp接口模块
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 800)]
|
||||
public class ErpToWmsService : IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarRepository<WmsPurchaseH> _repository;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
public ErpToWmsService(ISqlSugarRepository<WmsPurchaseH> repository, IBillRullService billRuleService)
|
||||
{
|
||||
_repository = repository;
|
||||
_billRuleService = billRuleService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 采购到货单
|
||||
/// </summary>
|
||||
public async Task PurchaseArrive(PurchaseArriveInput input)
|
||||
{
|
||||
//主表 create_time 采购收货单号 bill_code 单据类型 bill_type 单据状态 status 业务类型 biz_type 入库仓库ID warehouse_id 供应商ID supplier_id 供应商名称supplier_name 生成类型 generate_type
|
||||
//子表 主表id bill_id 执行状态line_status 单位id unit_id 物料id material_id
|
||||
var db = _repository.AsSugarClient();
|
||||
WmsPurchaseH wmsPurchaseH = new WmsPurchaseH();
|
||||
string Code = await _billRuleService.GetBillNumber("WmsPurchase");
|
||||
wmsPurchaseH.bill_code = Code;
|
||||
wmsPurchaseH.bill_type = "25103333373205";//收料通知单(到货单)
|
||||
wmsPurchaseH.biz_type = "26191496816421";//一般入库
|
||||
wmsPurchaseH.status = "25065138925589";//新增
|
||||
wmsPurchaseH.generate_type = "1";//0人工 1自动
|
||||
wmsPurchaseH.create_time = DateTime.Now;
|
||||
wmsPurchaseH.source_id = input.source_id;
|
||||
wmsPurchaseH.source_code = input.source_code;
|
||||
wmsPurchaseH.delivery_date = input.delivery_date;
|
||||
wmsPurchaseH.shipping_method = input.shipping_method;
|
||||
var warehouse = await db.Queryable<BasWarehouse>().Where(p => p.whcode == input.warehouse).FirstAsync();
|
||||
if (warehouse != null)
|
||||
wmsPurchaseH.warehouse_id = warehouse.id;
|
||||
wmsPurchaseH.supplier_code = input.supplier_code;
|
||||
var supplier = await db.Queryable<BasSupplier>().Where(p => p.supplier_code == input.supplier_code).FirstAsync();
|
||||
if (supplier != null)
|
||||
{
|
||||
wmsPurchaseH.supplier_id = supplier.id;
|
||||
wmsPurchaseH.supplier_name = supplier.supplier_name;
|
||||
}
|
||||
List<WmsPurchaseD> WmsPurchaseDs = new List<WmsPurchaseD>();
|
||||
foreach (var detail in input.details)
|
||||
{
|
||||
WmsPurchaseD wmsPurchased = new WmsPurchaseD();
|
||||
wmsPurchased.bill_id = wmsPurchaseH.id;
|
||||
wmsPurchased.line_status = "25065138925589";//新增
|
||||
wmsPurchased.purchase_qty = detail.purchase_qty;
|
||||
wmsPurchased.purchase_prqty = detail.purchase_prqty;
|
||||
wmsPurchased.code_batch = detail.code_batch;
|
||||
wmsPurchased.purchase_arriveqty = detail.purchase_arriveqty;
|
||||
wmsPurchased.container_no = detail.container_no;
|
||||
wmsPurchased.material_code = detail.material_code;
|
||||
var material = await db.Queryable<BasMaterial>().Where(p => p.code == detail.material_code).FirstAsync();
|
||||
if (material != null)
|
||||
{
|
||||
wmsPurchased.material_id = material.id;
|
||||
// wmsPurchased.material_name = material.name;
|
||||
wmsPurchased.unit_id = material.unit_id;
|
||||
}
|
||||
WmsPurchaseDs.Add(wmsPurchased);
|
||||
}
|
||||
await db.Insertable(wmsPurchaseH).ExecuteCommandAsync();
|
||||
await db.Insertable(WmsPurchaseDs).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 采购退货单
|
||||
/// </summary>
|
||||
public async Task PurchaseReturn(PurchaseReturnInput input)
|
||||
{
|
||||
//主表 create_time 采购收货单号 bill_code 单据类型 bill_type 单据状态 status 业务类型 biz_type 入库仓库ID warehouse_id 供应商ID supplier_id 供应商名称supplier_name 生成类型 generate_type
|
||||
//子表 主表id bill_id 执行状态line_status 单位id unit_id 物料id material_id
|
||||
var db = _repository.AsSugarClient();
|
||||
WmsPurchaseH wmsPurchaseH = new WmsPurchaseH();
|
||||
string Code = await _billRuleService.GetBillNumber("WmsPurchase");
|
||||
wmsPurchaseH.bill_code = Code;
|
||||
wmsPurchaseH.bill_type = "25103345478421";//采购退料单
|
||||
wmsPurchaseH.biz_type = "26191522660645";//一般出库
|
||||
wmsPurchaseH.status = "25065138925589";//新增
|
||||
wmsPurchaseH.generate_type = "1";//0人工 1自动
|
||||
wmsPurchaseH.create_time = DateTime.Now;
|
||||
wmsPurchaseH.source_id = input.source_id;
|
||||
wmsPurchaseH.source_code = input.source_code;
|
||||
wmsPurchaseH.delivery_date = input.delivery_date;
|
||||
wmsPurchaseH.shipping_method = input.shipping_method;
|
||||
var warehouse = await db.Queryable<BasWarehouse>().Where(p => p.whcode == input.warehouse).FirstAsync();
|
||||
if (warehouse != null)
|
||||
wmsPurchaseH.warehouse_id = warehouse.id;
|
||||
wmsPurchaseH.supplier_code = input.supplier_code;
|
||||
var supplier = await db.Queryable<BasSupplier>().Where(p => p.supplier_code == input.supplier_code).FirstAsync();
|
||||
if (supplier != null)
|
||||
{
|
||||
wmsPurchaseH.supplier_id = supplier.id;
|
||||
|
||||
wmsPurchaseH.supplier_name = supplier.supplier_name;
|
||||
}
|
||||
List<WmsPurchaseD> WmsPurchaseDs = new List<WmsPurchaseD>();
|
||||
foreach (var detail in input.details)
|
||||
{
|
||||
WmsPurchaseD wmsPurchased = new WmsPurchaseD();
|
||||
wmsPurchased.bill_id = wmsPurchaseH.id;
|
||||
wmsPurchased.line_status = "25065138925589";//新增
|
||||
wmsPurchased.purchase_qty = detail.purchase_qty;
|
||||
wmsPurchased.purchase_prqty = detail.purchase_prqty;
|
||||
wmsPurchased.code_batch = detail.code_batch;
|
||||
wmsPurchased.purchase_arriveqty = detail.purchase_arriveqty;
|
||||
wmsPurchased.container_no = detail.container_no;
|
||||
wmsPurchased.material_code = detail.material_code;
|
||||
var material = await db.Queryable<BasMaterial>().Where(p => p.code == detail.material_code).FirstAsync();
|
||||
if (material != null)
|
||||
{
|
||||
wmsPurchased.material_id = material.id;
|
||||
// wmsPurchased.material_name = material.name;
|
||||
wmsPurchased.unit_id = material.unit_id;
|
||||
}
|
||||
WmsPurchaseDs.Add(wmsPurchased);
|
||||
}
|
||||
await db.Insertable(wmsPurchaseH).ExecuteCommandAsync();
|
||||
await db.Insertable(WmsPurchaseDs).ExecuteCommandAsync();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 仓库调拨
|
||||
/// </summary>
|
||||
public async Task Allot(AllotInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
WmsAllot wmsAllot = new WmsAllot();
|
||||
string Code = await _billRuleService.GetBillNumber("WmsTransfer");
|
||||
wmsAllot.bill_code = Code;
|
||||
wmsAllot.biz_type = "25044010525205";//仓库调拨
|
||||
wmsAllot.status = "25065138925589";//新增
|
||||
var warehouse = await db.Queryable<BasWarehouse>().Where(p => p.whcode == input.warehouse).FirstAsync();
|
||||
if (warehouse != null)
|
||||
wmsAllot.warehouse_id = warehouse.id;
|
||||
var startloc = await db.Queryable<BasLocation>().Where(p => p.location_code == input.startlocation).FirstAsync();
|
||||
if (startloc != null)
|
||||
wmsAllot.startlocation_id = startloc.id;
|
||||
var endloc = await db.Queryable<BasLocation>().Where(p => p.location_code == input.endlocation).FirstAsync();
|
||||
if (endloc != null)
|
||||
wmsAllot.endlocation_id = endloc.id;
|
||||
wmsAllot.create_time = DateTime.Now;
|
||||
await db.Insertable(wmsAllot).ExecuteCommandAsync();
|
||||
}
|
||||
/// <summary>
|
||||
/// 销售出库单
|
||||
/// </summary>
|
||||
public async Task SaleOut(SaleOutInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
WmsSaleH WmsSaleH = new WmsSaleH();
|
||||
string Code = await _billRuleService.GetBillNumber("WmsSale");
|
||||
WmsSaleH.bill_code = Code;
|
||||
WmsSaleH.bill_type = "25103439022357";//销售出库单
|
||||
WmsSaleH.biz_type = "26191522660645";//一般出库
|
||||
WmsSaleH.status = "25065138925589";//新增
|
||||
WmsSaleH.generate_type = "1";//0人工 1自动
|
||||
WmsSaleH.create_time = DateTime.Now;
|
||||
WmsSaleH.source_id = input.source_id;
|
||||
WmsSaleH.source_code = input.source_code;
|
||||
WmsSaleH.ship_date = input.ship_date;
|
||||
WmsSaleH.shipping_method = input.shipping_method;
|
||||
var warehouse = await db.Queryable<BasWarehouse>().Where(p => p.whcode == input.warehouse).FirstAsync();
|
||||
if (warehouse != null)
|
||||
WmsSaleH.warehouse_id = warehouse.id;
|
||||
WmsSaleH.customer_code = input.customer_code;
|
||||
var customer = await db.Queryable<BasCustomer>().Where(p => p.customer_code == input.customer_code).FirstAsync();
|
||||
if (customer != null)
|
||||
{
|
||||
WmsSaleH.customer_id = customer.id;
|
||||
WmsSaleH.customer_name = customer.customer_name;
|
||||
}
|
||||
List<WmsSaleD> WmsSaleDs = new List<WmsSaleD>();
|
||||
foreach (var detail in input.details)
|
||||
{
|
||||
WmsSaleD WmsSaleD = new WmsSaleD();
|
||||
WmsSaleD.bill_id = WmsSaleH.id;
|
||||
WmsSaleD.line_status = "25065138925589";//新增
|
||||
WmsSaleD.purchase_qty = detail.purchase_qty;
|
||||
WmsSaleD.purchase_prqty = detail.purchase_prqty;
|
||||
WmsSaleD.code_batch = detail.code_batch;
|
||||
WmsSaleD.purchase_arriveqty = detail.purchase_arriveqty;
|
||||
WmsSaleD.container_no = detail.container_no;
|
||||
WmsSaleD.material_code = detail.material_code;
|
||||
var material = await db.Queryable<BasMaterial>().Where(p => p.code == detail.material_code).FirstAsync();
|
||||
if (material != null)
|
||||
{
|
||||
WmsSaleD.material_id = material.id;
|
||||
// WmsSaleD.material_name = material.name;
|
||||
WmsSaleD.unit_id = material.unit_id;
|
||||
}
|
||||
WmsSaleDs.Add(WmsSaleD);
|
||||
}
|
||||
await db.Insertable(WmsSaleH).ExecuteCommandAsync();
|
||||
await db.Insertable(WmsSaleDs).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,8 @@ namespace Tnb.WarehouseMgr
|
||||
var blFlag = true;
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
WmsInstockH? instock = null;
|
||||
var purchaseDs = await PurchaseAndSaleUpdate(input);
|
||||
|
||||
Reference in New Issue
Block a user