Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using JNPF.Common.Core.Manager;
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Extension;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||||
@@ -52,9 +53,16 @@ namespace Tnb.BasicData
|
|||||||
var elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
var elapsedMilliseconds = stopwatch.ElapsedMilliseconds;
|
||||||
ThirdResult thirdResult = new ThirdResult();
|
ThirdResult thirdResult = new ThirdResult();
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (response != null && !response.IsEmpty())
|
||||||
{
|
{
|
||||||
thirdResult = JsonConvert.DeserializeObject<ThirdResult>(response);
|
thirdResult = JsonConvert.DeserializeObject<ThirdResult>(response);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thirdResult.Code = 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
thirdResult.Code = 500;
|
thirdResult.Code = 500;
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ public partial class ToolMoldMaintainRule : BaseEntity<string>
|
|||||||
{
|
{
|
||||||
id = SnowflakeIdHelper.NextId();
|
id = SnowflakeIdHelper.NextId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
public string name { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保养方式
|
/// 保养方式
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -19,6 +19,11 @@ public partial class ToolMolds : BaseEntity<string>
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string? mold_code { get; set; }
|
public string? mold_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 组织id
|
||||||
|
/// </summary>
|
||||||
|
public string org_id {get;set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模具名称
|
/// 模具名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -55,7 +60,7 @@ public partial class ToolMolds : BaseEntity<string>
|
|||||||
public string? mold_status { get; set; }
|
public string? mold_status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 日定额
|
/// 班定额
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal? daily_rate { get; set; }
|
public decimal? daily_rate { get; set; }
|
||||||
|
|
||||||
@@ -65,7 +70,7 @@ public partial class ToolMolds : BaseEntity<string>
|
|||||||
public decimal? hour_norm { get; set; }
|
public decimal? hour_norm { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 成长周期
|
/// 成长周期 秒
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal? growth_cycle { get; set; }
|
public decimal? growth_cycle { get; set; }
|
||||||
|
|
||||||
@@ -75,7 +80,7 @@ public partial class ToolMolds : BaseEntity<string>
|
|||||||
public int? cavity_qty { get; set; }
|
public int? cavity_qty { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模具寿命
|
/// 模具寿命 模
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? mold_life { get; set; }
|
public int? mold_life { get; set; }
|
||||||
|
|
||||||
@@ -125,10 +130,15 @@ public partial class ToolMolds : BaseEntity<string>
|
|||||||
public string? extras { get; set; }
|
public string? extras { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模穴数
|
/// 有效模穴数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? mold_cavity { get; set; }
|
public int? mold_cavity { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 出厂模穴数
|
||||||
|
/// </summary>
|
||||||
|
public int? ex_factory_mold_cavity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 模具型号
|
/// 模具型号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -140,4 +150,37 @@ public partial class ToolMolds : BaseEntity<string>
|
|||||||
|
|
||||||
public string qrcode { get; set; }
|
public string qrcode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 供应商id
|
||||||
|
/// </summary>
|
||||||
|
public string supplier_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 验收时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? check_time { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 质保期开始
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? warranty_period_start_time { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 质保期结束
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? warranty_period_end_time { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 开模时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? open_time { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 模具地点
|
||||||
|
/// </summary>
|
||||||
|
public string address { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 模具规格
|
||||||
|
/// </summary>
|
||||||
|
public string mold_specification {get;set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 图纸图号
|
||||||
|
/// </summary>
|
||||||
|
public string url { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ using JNPF.Common.Filter;
|
|||||||
using JNPF.Common.Security;
|
using JNPF.Common.Security;
|
||||||
using JNPF.EventBus;
|
using JNPF.EventBus;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
|
using JNPF.Systems.Entitys.System;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.Common.Utils;
|
using Tnb.Common.Utils;
|
||||||
@@ -22,6 +24,8 @@ using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
|||||||
using Tnb.WarehouseMgr.Entities.Dto.Queries;
|
using Tnb.WarehouseMgr.Entities.Dto.Queries;
|
||||||
using Tnb.WarehouseMgr.Entities.Enums;
|
using Tnb.WarehouseMgr.Entities.Enums;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
{
|
{
|
||||||
@@ -307,6 +311,99 @@ namespace Tnb.WarehouseMgr
|
|||||||
instock.status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
instock.status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||||
}
|
}
|
||||||
_ = await _db.Updateable(instock).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
_ = await _db.Updateable(instock).UpdateColumns(it => it.status).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
|
||||||
|
List<String> materialIds = allInstockDetails.Select(x=>x.material_id).Distinct().ToList();
|
||||||
|
List<String> unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList();
|
||||||
|
List<DictionaryDataEntity> unitDatas = await _db.Queryable<DictionaryTypeEntity>()
|
||||||
|
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||||
|
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode))
|
||||||
|
.Select((x,y)=>y)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
List<string> tableIds = new List<string>();
|
||||||
|
tableIds.Add(_userManager.UserId);
|
||||||
|
tableIds.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||||
|
tableIds.Add(instock.warehouse_id);
|
||||||
|
tableIds.AddRange(materialIds);
|
||||||
|
tableIds.Add(instock.supplier_id);
|
||||||
|
tableIds.AddRange(unitDatas.Select(x=>x.Id).ToList());
|
||||||
|
|
||||||
|
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x=>tableIds.Contains(x.table_id)).ToListAsync();
|
||||||
|
string erpCreateId = erpExtendFields.Find(x=>x.table_id==instock.create_id)?.user_id ?? "";
|
||||||
|
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId));
|
||||||
|
string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> requestData = new List<Dictionary<string, object>>();
|
||||||
|
Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
||||||
|
erpRequestData.Add("approver",erpCreateId);
|
||||||
|
erpRequestData.Add("billmaker",erpCreateId);
|
||||||
|
erpRequestData.Add("bitinbill",false);
|
||||||
|
erpRequestData.Add("cgeneralhid",null);
|
||||||
|
erpRequestData.Add("corpoid",erpOrg.corpoid);
|
||||||
|
erpRequestData.Add("corpvid",erpOrg.corpvid);
|
||||||
|
erpRequestData.Add("creationtime",nowStr);
|
||||||
|
erpRequestData.Add("creator",erpCreateId);
|
||||||
|
erpRequestData.Add("ctrantypeid","");
|
||||||
|
erpRequestData.Add("cvendorid",erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_id ?? "");
|
||||||
|
erpRequestData.Add("cvendorvid",erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_vid ?? "");
|
||||||
|
erpRequestData.Add("cwarehouseid",erpExtendFields.Find(x=>x.table_id==instock.warehouse_id)?.cotherwhid ?? "");//类型视图里取
|
||||||
|
erpRequestData.Add("dbilldate",nowStr);
|
||||||
|
erpRequestData.Add("dmakedate",nowStr);
|
||||||
|
erpRequestData.Add("fbillflag",2);
|
||||||
|
erpRequestData.Add("fbuysellflag",2);
|
||||||
|
erpRequestData.Add("ntotalnum",allInstockDetails.Sum(x=>x.qty));
|
||||||
|
erpRequestData.Add("pk_org",erpOrg.pk_org);
|
||||||
|
erpRequestData.Add("pk_org_v",erpOrg.pk_org_v);
|
||||||
|
erpRequestData.Add("pk_group",erpOrg.pk_group);
|
||||||
|
erpRequestData.Add("vbillcode",null);
|
||||||
|
erpRequestData.Add("vtrantypecode",null);
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
|
foreach(WmsInstockD item in allInstockDetails)
|
||||||
|
{
|
||||||
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["castunitid"] = erpExtendFields.Find(x=>x.table_id==(unitDatas.Find(x=>x.EnCode==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
|
["cbodytranstypecode"] = "",
|
||||||
|
["cbodywarehouseid"] = erpExtendFields.Find(x=>x.table_id==instock.warehouse_id)?.cotherwhid ?? "",
|
||||||
|
["cgeneralbid"] = "",
|
||||||
|
["cgeneralhid"] = "",
|
||||||
|
["cmaterialoid"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialoid ?? "",
|
||||||
|
["cmaterialvid"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialvid ?? "",
|
||||||
|
["corpoid"] = erpOrg.corpoid,
|
||||||
|
["corpvid"] = erpOrg.corpvid,
|
||||||
|
["crowno"] = (allInstockDetails.FindIndex(x=>x.id==item.id)+1) * 10,
|
||||||
|
["cunitid"] = erpExtendFields.Find(x=>x.table_id==(unitDatas.Find(x=>x.EnCode==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
|
["cvendorid"] = erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_id ?? "",
|
||||||
|
["cvendorvid"] = erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_vid ?? "",
|
||||||
|
["dbizdate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
|
["nnum"] = item.qty,
|
||||||
|
["nshouldnum"] = item.pr_qty,
|
||||||
|
["pk_creqwareid"] = erpExtendFields.Find(x=>x.table_id==instock.warehouse_id)?.cotherwhid ?? "",
|
||||||
|
["pk_group"] = erpOrg.pk_group,
|
||||||
|
["pk_org"] = erpOrg.pk_org,
|
||||||
|
["pk_org_v"] = erpOrg.pk_org_v,
|
||||||
|
["pseudocolumn"] = (allInstockDetails.FindIndex(x=>x.id==item.id)+1) * 10,
|
||||||
|
["vbatchcode"] = item.code_batch,
|
||||||
|
["vfree1"] = erpExtendFields.Find(x=>x.table_id==instock.supplier_id)?.supplier_id ?? "",
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
erpRequestData.Add("PurchaseInBodyVODtl",erpRequestDataDetails);
|
||||||
|
requestData.Add(erpRequestData);
|
||||||
|
|
||||||
|
ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord();
|
||||||
|
thirdWebapiRecord.id = SnowflakeIdHelper.NextId();
|
||||||
|
thirdWebapiRecord.third_name = WmsWareHouseConst.BIP;
|
||||||
|
thirdWebapiRecord.name = "采购入库";
|
||||||
|
thirdWebapiRecord.method = "POST";
|
||||||
|
thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN+"uapws/rest/purarrvial/save";
|
||||||
|
thirdWebapiRecord.request_data = JsonConvert.SerializeObject(erpRequestData);
|
||||||
|
thirdWebapiRecord.create_time = DateTime.Now;
|
||||||
|
|
||||||
|
await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await _db.Ado.CommitTranAsync();
|
await _db.Ado.CommitTranAsync();
|
||||||
|
|||||||
@@ -141,9 +141,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
erpRequestData.Add("billmaker",erpCreateId);
|
erpRequestData.Add("billmaker",erpCreateId);
|
||||||
erpRequestData.Add("creationtime",nowStr);
|
erpRequestData.Add("creationtime",nowStr);
|
||||||
erpRequestData.Add("creator",erpCreateId);
|
erpRequestData.Add("creator",erpCreateId);
|
||||||
erpRequestData.Add("dbilldate",purchase.delivery_date.ToString("yyyy-MM-dd HH:mm:ss"));
|
erpRequestData.Add("dbilldate",purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||||
erpRequestData.Add("dmakedate",nowStr);
|
erpRequestData.Add("dmakedate",nowStr);
|
||||||
//erpRequestData.Add("ntotalastnum",purchaseDs.Sum(x=>x.purchase_arriveqty));
|
erpRequestData.Add("ntotalastnum",purchaseDs.Sum(x=>x.purchase_arriveqty));
|
||||||
erpRequestData.Add("pk_arriveorder","");
|
erpRequestData.Add("pk_arriveorder","");
|
||||||
// erpRequestData.Add("pk_dept","1001A1100000000JRLI1");
|
// erpRequestData.Add("pk_dept","1001A1100000000JRLI1");
|
||||||
// erpRequestData.Add("pk_dept_v","0001A11000000007GGO8");
|
// erpRequestData.Add("pk_dept_v","0001A11000000007GGO8");
|
||||||
@@ -174,21 +174,23 @@ namespace Tnb.WarehouseMgr
|
|||||||
["csourcetypecode"] = "",
|
["csourcetypecode"] = "",
|
||||||
["ctaxcountryid"] = "0001Z010000000079UJJ",
|
["ctaxcountryid"] = "0001Z010000000079UJJ",
|
||||||
["cunitid"] = erpExtendFields.Find(x=>x.table_id==(unitDatas.Find(x=>x.EnCode==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
["cunitid"] = erpExtendFields.Find(x=>x.table_id==(unitDatas.Find(x=>x.EnCode==item.unit_id)?.Id ?? ""))?.cunitid ?? "",
|
||||||
["dbilldate"] = "",
|
["dbilldate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
["dplanreceivedate"] = "",
|
["dplanreceivedate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
["dproducedate"] = "",
|
["dproducedate"] = purchase.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
["fbuysellflag"] = 1,
|
["fbuysellflag"] = 1,
|
||||||
["fproductclass"] = 1,
|
["fproductclass"] = 1,
|
||||||
["naccumchecknum"] = 0,
|
["naccumchecknum"] = 0,
|
||||||
["nastnum"] = item.purchase_arriveqty,
|
// ["nastnum"] = item.purchase_arriveqty,
|
||||||
["nnum"] = null,
|
["nnum"] = item.purchase_arriveqty,
|
||||||
// ["nplanastnum"] = 0,
|
// ["nplanastnum"] = 0,
|
||||||
// ["nplannum"] = item.purchase_qty,
|
["nplannum"] = item.purchase_qty,
|
||||||
["apfinanceorg"] = erpOrg.pk_org,
|
["apfinanceorg"] = erpOrg.pk_org,
|
||||||
["pk_apfinanceorg_v"] = erpOrg.pk_org_v,
|
["pk_apfinanceorg_v"] = erpOrg.pk_org_v,
|
||||||
["pk_arriveorder"] = "",
|
["pk_arriveorder"] = "",
|
||||||
["pk_arriveorder_b"] = "",
|
["pk_arriveorder_b"] = "",
|
||||||
["pk_group"] = "",
|
["pk_group"] = "",
|
||||||
|
["csourcebid"] = wmsPurchaseOrderDs.erp_line_pk,
|
||||||
|
["csourceid"] = wmsPurchaseOrderH?.erp_pk ?? "",
|
||||||
["pk_material"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialoid ?? "",
|
["pk_material"] = erpExtendFields.Find(x=>x.table_id==item.material_id)?.cmaterialoid ?? "",
|
||||||
["pk_order"] = wmsPurchaseOrderH?.erp_pk ?? "",
|
["pk_order"] = wmsPurchaseOrderH?.erp_pk ?? "",
|
||||||
["pk_order_b"] = wmsPurchaseOrderDs.erp_line_pk,
|
["pk_order_b"] = wmsPurchaseOrderDs.erp_line_pk,
|
||||||
|
|||||||
Reference in New Issue
Block a user