erp 其他出库接口
This commit is contained in:
@@ -7,7 +7,7 @@ namespace Tnb.ProductionMgr.Entities.Entity
|
|||||||
/// erp扩展字段
|
/// erp扩展字段
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("erp_extend_field")]
|
[SugarTable("erp_extend_field")]
|
||||||
public class ErpExtendField: BaseEntity<string>
|
public class ErpExtendField
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 天益表名
|
/// 天益表名
|
||||||
@@ -35,8 +35,66 @@ namespace Tnb.ProductionMgr.Entities.Entity
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string erp_line_pk { get; set; }
|
public string erp_line_pk { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户id
|
||||||
|
/// </summary>
|
||||||
public string user_id { get; set; }
|
public string user_id { get; set; }
|
||||||
|
|
||||||
public DateTime create_time { get; set; }
|
public DateTime create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 公司id
|
||||||
|
/// </summary>
|
||||||
|
public string corpoid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 公司vid
|
||||||
|
/// </summary>
|
||||||
|
public string corpvid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 部门id
|
||||||
|
/// </summary>
|
||||||
|
public string cdptid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 部门vid
|
||||||
|
/// </summary>
|
||||||
|
public string cdptvid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 入库仓库id
|
||||||
|
/// </summary>
|
||||||
|
public string cotherwhid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 集团id
|
||||||
|
/// </summary>
|
||||||
|
public string pk_group { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 组织id
|
||||||
|
/// </summary>
|
||||||
|
public string pk_org { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 组织vid
|
||||||
|
/// </summary>
|
||||||
|
public string pk_org_v { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料id
|
||||||
|
/// </summary>
|
||||||
|
public string cmaterialoid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料vid
|
||||||
|
/// </summary>
|
||||||
|
public string cmaterialvid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位id
|
||||||
|
/// </summary>
|
||||||
|
public string cunitid { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,6 @@ namespace Tnb.ProductionMgr
|
|||||||
moList.Add(item);
|
moList.Add(item);
|
||||||
extendFieldList.Add(new ErpExtendField()
|
extendFieldList.Add(new ErpExtendField()
|
||||||
{
|
{
|
||||||
id = SnowflakeIdHelper.NextId(),
|
|
||||||
org_id =WmsWareHouseConst.AdministratorOrgId,
|
org_id =WmsWareHouseConst.AdministratorOrgId,
|
||||||
table_name = "prd_mo",
|
table_name = "prd_mo",
|
||||||
table_id = item.id,
|
table_id = item.id,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -40,6 +41,7 @@ using NPOI.SS.Formula.Functions;
|
|||||||
using Org.BouncyCastle.Asn1.X509;
|
using Org.BouncyCastle.Asn1.X509;
|
||||||
using Tnb.ProductionMgr.Entities;
|
using Tnb.ProductionMgr.Entities;
|
||||||
using Tnb.BasicData;
|
using Tnb.BasicData;
|
||||||
|
using Tnb.ProductionMgr.Entities.Entity;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -624,6 +626,84 @@ namespace Tnb.WarehouseMgr
|
|||||||
if (input.area_code == "E")
|
if (input.area_code == "E")
|
||||||
await sign(input);
|
await sign(input);
|
||||||
|
|
||||||
|
|
||||||
|
WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable<WmsMaterialTransfer>().SingleAsync(x => x.id == wmsMaterialTransferd.bill_id);
|
||||||
|
List<WmsMaterialTransferD> dList = await _db.Queryable<WmsMaterialTransferD>().Where(x => x.bill_id == wmsMaterialTransferd.bill_id).OrderBy(x=>x.id).ToListAsync();
|
||||||
|
DictionaryDataEntity unitData = await _db.Queryable<DictionaryTypeEntity>()
|
||||||
|
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
|
||||||
|
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && y.EnCode == wmsMaterialTransferd.unit_id)
|
||||||
|
.Select((x,y)=>y)
|
||||||
|
.FirstAsync();
|
||||||
|
List<string> ids = new List<string>();
|
||||||
|
ids.Add(wmsMaterialTransfer.create_id);
|
||||||
|
ids.Add(WmsWareHouseConst.AdministratorOrgId);
|
||||||
|
ids.Add(wmsMaterialTransfer.warehouse_outstock);
|
||||||
|
ids.Add(wmsMaterialTransfer.warehouse_instock);
|
||||||
|
ids.Add(wmsMaterialTransferd.material_id);
|
||||||
|
ids.Add(unitData.Id);
|
||||||
|
|
||||||
|
List<ErpExtendField> erpExtendFields = await _db.Queryable<ErpExtendField>().Where(x=>ids.Contains(x.table_id)).ToListAsync();
|
||||||
|
|
||||||
|
ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == wmsMaterialTransfer.org_id);
|
||||||
|
if (erpOrg == null)
|
||||||
|
throw Oops.Bah("未配置erp组织");
|
||||||
|
string erpCreateId = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.create_id)?.user_id ?? "";
|
||||||
|
|
||||||
|
Dictionary<string, object> erpRequestData = new Dictionary<string, object>();
|
||||||
|
erpRequestData.Add("billmaker",erpCreateId);
|
||||||
|
erpRequestData.Add("cdptid","1001A1100000000JRLI1A100");// 先写死
|
||||||
|
erpRequestData.Add("cdptvid","0001A11000000007GGO8");// 先写死
|
||||||
|
erpRequestData.Add("corpoid",erpOrg.corpoid);
|
||||||
|
erpRequestData.Add("corpvid",erpOrg.corpoid);
|
||||||
|
erpRequestData.Add("cothercalbodyoid",erpOrg.cdptid);
|
||||||
|
erpRequestData.Add("cotherwhid",erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "");
|
||||||
|
erpRequestData.Add("creationtime",DateTime.Now);
|
||||||
|
erpRequestData.Add("creator",erpCreateId);
|
||||||
|
erpRequestData.Add("ctrantypeid","0001H11000000000D31W");
|
||||||
|
erpRequestData.Add("cwarehouseid",erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_outstock)?.cotherwhid ?? "");
|
||||||
|
erpRequestData.Add("dbilldate",DateTime.Now);
|
||||||
|
erpRequestData.Add("dmakedate",DateTime.Now);
|
||||||
|
erpRequestData.Add("ntotalnum",wmsCarryCodes.Sum(r => r.codeqty));
|
||||||
|
erpRequestData.Add("pk_group",erpOrg.pk_group);
|
||||||
|
erpRequestData.Add("pk_org",erpOrg.pk_org);
|
||||||
|
erpRequestData.Add("pk_org_v",erpOrg.pk_org_v);
|
||||||
|
erpRequestData.Add("vbillcode",wmsMaterialTransfer.bill_code);
|
||||||
|
erpRequestData.Add("vtrantypecode","4I-01");//其他出库 先写死
|
||||||
|
List<Dictionary<string, object>> erpRequestDataDetails = new List<Dictionary<string, object>>();
|
||||||
|
erpRequestDataDetails.Add(new Dictionary<string, object>()
|
||||||
|
{
|
||||||
|
["cbodytranstypecode"] = "4I-01",
|
||||||
|
["cbodywarehouseid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_outstock)?.cotherwhid ?? "",
|
||||||
|
["cmaterialoid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransferd.material_id)?.cmaterialoid ?? "",
|
||||||
|
["cmaterialvid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransferd.material_id)?.cmaterialvid ?? "",
|
||||||
|
["corpoid"] = erpOrg.corpoid,
|
||||||
|
["corpvid"] = erpOrg.corpvid,
|
||||||
|
["crowno"] = (dList.FindIndex(x=>x.id==wmsMaterialTransferd.id)+1) * 10,
|
||||||
|
["csourcebillbid"] = wmsMaterialTransferd.id,
|
||||||
|
["csourcebillhid"] = wmsMaterialTransferd.bill_id,
|
||||||
|
["cunitid"] = erpExtendFields.Find(x=>x.table_id==unitData.Id)?.cunitid ?? "",
|
||||||
|
["cvendorid"] = "",
|
||||||
|
["cvendorvid"] = "",
|
||||||
|
["dbizdate"] = DateTime.Now,
|
||||||
|
["nnum"] = wmsCarryCodes.Sum(r => r.codeqty),
|
||||||
|
["nshouldnum"] = wmsMaterialTransferd.qty,
|
||||||
|
["pk_group"] = erpOrg.pk_group,
|
||||||
|
["pk_org"] = erpOrg.pk_org,
|
||||||
|
["pk_org_v"] = erpOrg.pk_org_v,
|
||||||
|
["vbatchcode"] = wmsMaterialTransferd.code_batch,
|
||||||
|
});
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
|
|||||||
@@ -129,8 +129,7 @@ public class TestService : IDynamicApiController, ITransient
|
|||||||
insertUserRelations.Add(userRelationEntity);
|
insertUserRelations.Add(userRelationEntity);
|
||||||
|
|
||||||
ErpExtendField extendField = new ErpExtendField();
|
ErpExtendField extendField = new ErpExtendField();
|
||||||
extendField.id = SnowflakeIdHelper.NextId();
|
extendField.org_id = "25193668006933";
|
||||||
extendField.org_id = "25398501929509";
|
|
||||||
extendField.table_name = "base_user";
|
extendField.table_name = "base_user";
|
||||||
extendField.table_id = userEntity.Id;
|
extendField.table_id = userEntity.Id;
|
||||||
extendField.user_id = user.id;
|
extendField.user_id = user.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user