This commit is contained in:
2024-07-18 10:29:11 +08:00
10 changed files with 185 additions and 47 deletions

View File

@@ -0,0 +1,22 @@
using JNPF.Common.Contracts;
using SqlSugar;
namespace Tnb.ProductionMgr.Entities.Entity
{
[SugarTable("ERP_BD_MATERIAL")]
public class ErpBdMaterial: BaseEntity<string>
{
public string CODE { get; set; }
public string PK_ORG { get; set; }
public string NAME { get; set; }
public string MATERIALSPEC { get; set; }
public string MATERIALTYPE { get; set; }
public string PK_MEASDOC { get; set; }
public string MEASRATE { get; set; }
public string FMEASDOC { get; set; }
public string VID { get; set; }
public string MEANAME { get; set; }
public string FMEANAME { get; set; }
public string AID { get; set; }
}
}

View File

@@ -1724,7 +1724,7 @@ namespace Tnb.ProductionMgr
// }
// report.warehouse_id = WmsWareHouseConst.WAREHOUSE_JXK_ID;
report.warehouse_id = WmsWareHouseConst.WAREHOUSE_SLDMJC_ID;
report.warehouse_id = WmsWareHouseConst.WAREHOUSE_DMJC_ID;
Dictionary<string, string> worklineWarehouseDic = new Dictionary<string, string>()
{
[WmsWareHouseConst.XUELUGUAN1XIAN] = "ZZ-01-02",
@@ -2129,22 +2129,22 @@ namespace Tnb.ProductionMgr
// throw Oops.Bah(x2ServerResult.Msg);
// }
Dictionary<string, string> dicCommand4 = new(StringComparer.OrdinalIgnoreCase)
{
["DevName"] = "外包装箱码垛线",
["token"] = _eleCtlCfg.token,
["TagName"] = dic2[prdMoTask.workline_id],
["Value"] = "0",
};
Log.Information($"清除提报码垛数参数:{JsonConvert.SerializeObject(dicCommand4)}");
string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4);
Log.Information($"清除提报码垛数返回结果:{responseresult2}");
X2ServerResult x2ServerResult2 = JsonConvert.DeserializeObject<X2ServerResult>(responseresult2);
if (x2ServerResult2.Result != X2ServerResult.Ok)
{
throw Oops.Bah(x2ServerResult2.Msg);
}
// Dictionary<string, string> dicCommand4 = new(StringComparer.OrdinalIgnoreCase)
// {
// ["DevName"] = "外包装箱码垛线",
// ["token"] = _eleCtlCfg.token,
// ["TagName"] = dic2[prdMoTask.workline_id],
// ["Value"] = "0",
// };
//
// Log.Information($"清除提报码垛数参数:{JsonConvert.SerializeObject(dicCommand4)}");
// string responseresult2 = await HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand4);
// Log.Information($"清除提报码垛数返回结果:{responseresult2}");
// X2ServerResult x2ServerResult2 = JsonConvert.DeserializeObject<X2ServerResult>(responseresult2);
// if (x2ServerResult2.Result != X2ServerResult.Ok)
// {
// throw Oops.Bah(x2ServerResult2.Msg);
// }
}
if (basMaterial.category_id.Contains("ZSJ") || basMaterial.category_id.Contains("DGJCJ"))

View File

@@ -13,6 +13,7 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SqlSugar;
using Tnb.BasicData;
using Tnb.BasicData.Entities;
using Tnb.ProductionMgr.Entities;
using Tnb.ProductionMgr.Entities.Dto;
using Tnb.ProductionMgr.Interfaces;
@@ -89,27 +90,28 @@ namespace Tnb.ProductionMgr
}
}
ISqlSugarClient db = _repository.AsSugarClient();
SqlSugarPagedList<ReportRecordListOutput> result = await db.Queryable<PrdReportRecord>()
.LeftJoin<DictionaryDataEntity>((a, b) => a.mo_task_type == b.Id)
.LeftJoin<DictionaryDataEntity>((a, b, c) => a.status == c.EnCode)
.LeftJoin<PrdMoTask>((a, b, c, d) => a.mo_task_id == d.id)
SqlSugarPagedList<ReportRecordListOutput> result = await db.Queryable<PrdMoTask>()
.LeftJoin<PrdMo>((a,b)=>a.mo_id==b.id)
.LeftJoin<DictionaryDataEntity>((a, b,c) => b.mo_type == c.Id)
.LeftJoin<DictionaryDataEntity>((a, b, c,d) => a.mo_task_status == d.EnCode && d.DictionaryTypeId==DictConst.PrdTaskStatusTypeId)
.LeftJoin<BasMaterial>((a,b,c,d,e)=>a.material_id==e.id)
.WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c) => a.mo_task_code.Contains(moTaskCode))
.Select((a, b, c, d) => new ReportRecordListOutput
.Select((a, b, c, d,e) => new ReportRecordListOutput
{
id = a.id,
masterial_code = a.masterial_code,
mo_code = a.mo_code,
masterial_name = a.masterial_name,
masterial_code = e.code,
mo_code = b.mo_code,
masterial_name = e.name,
mo_task_code = a.mo_task_code,
mo_task_id = a.mo_task_code,
mo_task_id_id = a.mo_task_id,
mo_task_type = b.FullName,
plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-mm-dd"),
plan_start_date = a.plan_start_date == null ? "" : a.plan_start_date.Value.ToString("yyyy-mm-dd"),
plan_qty = d.scheduled_qty,
mo_task_id_id = a.id,
mo_task_type = c.FullName,
plan_end_date = a.estimated_end_date == null ? "" : a.estimated_end_date.Value.ToString("yyyy-mm-dd"),
plan_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-mm-dd"),
plan_qty = a.scheduled_qty,
reported_work_qty = a.reported_work_qty,
completed_qty = SqlFunc.IsNull(d.reported_work_qty, 0) + SqlFunc.IsNull(d.scrap_qty, 0),
status = c.FullName,
completed_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0),
status = d.FullName,
tablefield107 = SqlFunc.Subqueryable<PrdReport>()
.LeftJoin<UserEntity>((x, y) => x.create_id == y.Id)
.Where(x => x.mo_task_code == a.mo_task_code).ToList((x, y) => new ReportRecordListChildrenOutput
@@ -149,11 +151,11 @@ namespace Tnb.ProductionMgr
_ = await db.Insertable<PrdReport>(prdReports).ExecuteCommandAsync();
int? sum = prdReports.Sum(x => x.reported_qty);
_ = await db.Updateable<PrdReportRecord>()
.SetColumns(x => x.completed_qty == x.completed_qty + sum)
.SetColumns(x => x.reported_work_qty == x.reported_work_qty + sum)
.Where(x => x.id == input.data["id"].ToString()).ExecuteCommandAsync();
// int? sum = prdReports.Sum(x => x.reported_qty);
// _ = await db.Updateable<PrdReportRecord>()
// .SetColumns(x => x.completed_qty == x.completed_qty + sum)
// .SetColumns(x => x.reported_work_qty == x.reported_work_qty + sum)
// .Where(x => x.id == input.data["id"].ToString()).ExecuteCommandAsync();
});

View File

@@ -513,7 +513,10 @@ namespace Tnb.ProductionMgr
return msg;
}
/// <summary>
/// 自动提报
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<String> AutoPrdReport()
@@ -655,6 +658,17 @@ namespace Tnb.ProductionMgr
return "true";
}
/// <summary>
/// 同步基础数据
/// </summary>
/// <returns></returns>
[HttpGet]
[AllowAnonymous]
public async Task<String> SyncBaseData()
{
return "true";
}
}
}

View File

@@ -27,10 +27,6 @@
/// </summary>
public const string WAREHOUSE_ZCC_ID = "33780009364245";
/// <summary>
/// 四楼待灭菌仓
/// </summary>
public const string WAREHOUSE_SLDMJC_ID = "35412479754517";
/// <summary>
/// 四楼解析库
/// </summary>
public const string WAREHOUSE_JXK_ID = "26103367464997";

View File

@@ -2427,8 +2427,8 @@ namespace Tnb.WarehouseMgr
["cbodytranstypecode"] = "4A-01",
["cbodywarehouseid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "",
["cgeneralbid"] = erpExtendFields.Find(x=>x.table_id==wmsMaterialTransfer.warehouse_instock)?.cotherwhid ?? "",
["cgeneralbid"] = item.erp_line_pk ?? "",
["cgeneralhid"] = wmsMaterialTransfer.erp_pk ?? "",
["cgeneralbid"] = item.erp_line_pk,
["cgeneralhid"] = wmsMaterialTransfer.erp_pk,
["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,

View File

@@ -866,8 +866,8 @@ namespace Tnb.WarehouseMgr
["corpoid"] = erpOrg.corpoid,
["corpvid"] = erpOrg.corpvid,
["crowno"] = (dList.FindIndex(x=>x.id==wmsMaterialTransferd.id)+1) * 10,
["csourcebillbid"] = wmsMaterialTransferd.erp_line_pk ?? "",
["csourcebillhid"] = wmsMaterialTransfer.erp_pk ?? "",
["csourcebillbid"] = wmsMaterialTransferd.erp_line_pk,
["csourcebillhid"] = wmsMaterialTransfer.erp_pk,
["cunitid"] = erpExtendFields.Find(x=>x.table_id==unitData.Id)?.cunitid ?? "",
["cvendorid"] = "",
["cvendorvid"] = "",

View File

@@ -33,6 +33,26 @@ public static class ConfigureSqlSugarExtensions
},
});
foreach (var item in conn.ConfigList)
{
connectConfigList.Add(new ConnectionConfig
{
ConnectionString = item.connectionStr,
DbType = item.dbType,
IsAutoCloseConnection = true,
ConfigId = item.ServiceName,
InitKeyType = InitKeyType.Attribute,
MoreSettings = new ConnMoreSettings()
{
IsAutoRemoveDataCache = true, // 自动清理缓存
IsAutoToUpper = false,
//PgSqlIsAutoToLower = false,
DisableNvarchar = true
},
});
}
services.AddSqlSugar(connectConfigList, client =>
{
//connectConfigList.ForEach(config =>

View File

@@ -48,4 +48,6 @@ public sealed class ConnectionStringsOptions : IConfigurableOptions
public string DefaultConnection { get; set; }
public string ConnectString { get { return string.Format(DefaultConnection, Host, Port, DBName, UserName, Password); } }
public List<DBConnectionConfig> ConfigList { get; set; }
}

View File

@@ -11,6 +11,7 @@ using JNPF.Systems.Entitys.Permission;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Npgsql.TypeHandlers;
using SqlSugar;
using Tnb.ProductionMgr.Entities.Entity;
@@ -93,7 +94,9 @@ public class TestService : IDynamicApiController, ITransient
[AllowAnonymous]
public string test1()
{
return "测试成功";
var mysqlDb = _sugar.GetConnection("erpdb");
List<ErpBdMaterial> list = mysqlDb.Queryable<ErpBdMaterial>().ToList();
return JsonConvert.SerializeObject(list);
}
[HttpGet]
@@ -150,4 +153,83 @@ public class TestService : IDynamicApiController, ITransient
public string name { get; set; }
}
[SugarTable("bas_factory_config")]
public partial class BasFactoryConfig2 : BaseEntity<string>
{
public BasFactoryConfig2()
{
id = SnowflakeIdHelper.NextId();
}
/// <summary>
/// 名称
/// </summary>
public string name { get; set; } = string.Empty;
/// <summary>
/// key
/// </summary>
public string code { get; set; } = string.Empty;
/// <summary>
/// 值
/// </summary>
public string value { get; set; } = string.Empty;
/// <summary>
/// 是否启用
/// </summary>
public int enabled { get; set; }
/// <summary>
/// 备注
/// </summary>
public string? remark { get; set; }
/// <summary>
/// 创建用户
/// </summary>
public string? create_id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime? create_time { get; set; }
/// <summary>
/// 修改用户
/// </summary>
public string? modify_id { get; set; }
/// <summary>
/// 修改时间
/// </summary>
public DateTime? modify_time { get; set; }
/// <summary>
/// 所属组织
/// </summary>
public string? org_id { get; set; }
/// <summary>
/// 排序
/// </summary>
public long? ordinal { get; set; }
/// <summary>
/// 是否系统
/// </summary>
public int? is_system { get; set; }
/// <summary>
/// 流程任务Id
/// </summary>
public string? f_flowtaskid { get; set; }
/// <summary>
/// 流程引擎Id
/// </summary>
public string? f_flowid { get; set; }
}
}