diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs
index ddfc341b..4b25fed5 100644
--- a/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs
+++ b/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs
@@ -32,5 +32,12 @@ namespace Tnb.BasicData.Interfaces
///
///
public Task GetMaterialByQueryJson(MaterialQueryInput input);
+
+ ///
+ /// 获取物料的入库仓库
+ ///
+ ///
+ ///
+ public Task GetInboundWarehouseById(Dictionary dic);
}
}
\ No newline at end of file
diff --git a/BasicData/Tnb.BasicData/BasMaterialService.cs b/BasicData/Tnb.BasicData/BasMaterialService.cs
index fb4df1df..1b769e9d 100644
--- a/BasicData/Tnb.BasicData/BasMaterialService.cs
+++ b/BasicData/Tnb.BasicData/BasMaterialService.cs
@@ -220,6 +220,22 @@ namespace Tnb.BasicData
}
+ [HttpPost]
+ public async Task GetInboundWarehouseById(Dictionary dic)
+ {
+ string id = dic.ContainsKey("id") ? dic["id"] : "";
+
+ return await _repository.AsSugarClient().Queryable()
+ .LeftJoin((a, b) => a.wh_id == b.id)
+ .Where((a, b) => a.material_id == id)
+ .Select((a, b) => new
+ {
+ warehouse_id = a.wh_id,
+ warehouse_code = b.whcode,
+ warehouse_name = b.whname
+ }).ToListAsync();
+ }
+
///
/// 获取物料清单下所子集物料id
///
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs
index 9d415482..fe96dc58 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs
@@ -155,5 +155,16 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
/// 物料分类ID
///
public string category_id { get; set; } = string.Empty;
+
+ ///
+ /// 入库仓库id
+ ///
+ public string warehouse_id { get; set; }
+
+ public string warehouse_code { get; set; }
+
+ public string warehouse_name { get; set; }
+
+
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
index f19f3a84..a24b070f 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs
@@ -129,5 +129,10 @@ public partial class PrdReport : BaseEntity
/// 料箱编号
///
public string material_box_code { get; set; }
+
+ ///
+ /// 长管挤出入库库位
+ ///
+ public string location_code { get; set; }
}
diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs
index 9fdbb4e9..82f82e86 100644
--- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs
@@ -36,5 +36,12 @@ namespace Tnb.ProductionMgr.Interfaces
///
///
public Task InstockTubeOne(PrdReport prdReport);
+
+ ///
+ /// 长管管挤出入库申请
+ ///
+ ///
+ ///
+ public Task InstockTubeThree(PrdReport prdReport);
}
}
\ No newline at end of file
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
index 377649b8..44594713 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs
@@ -263,6 +263,7 @@ namespace Tnb.ProductionMgr
{
string equip_code = inut.equip_code;
string as_location_code = inut.as_location_code;
+ string warehouse_id = "2";
if (!string.IsNullOrEmpty(equip_code))
{
throw Oops.Bah("请传机台号");
@@ -315,7 +316,8 @@ namespace Tnb.ProductionMgr
workline_id = workline?.Id ?? "",
workshop_id = workshop?.Id ?? "",
org_id = _userManager.GetUserInfo().Result.organizeId,
- warehouse_id = basLocation?.wh_id,
+ // warehouse_id = basLocation?.wh_id,
+ warehouse_id = warehouse_id,
status = 0,
};
@@ -341,7 +343,8 @@ namespace Tnb.ProductionMgr
org_id = _userManager.GetUserInfo().Result.organizeId,
bill_date = DateTime.Now,
bill_type = DictConst.CHANCHENGPINRUKUDAN,
- warehouse_id = basLocation?.wh_id,
+ // warehouse_id = basLocation?.wh_id,
+ warehouse_id = warehouse_id,
source_id = prdInstockH.id,
create_id = _userManager.UserId,
carry_code = prdReport.material_box_code,
@@ -397,8 +400,118 @@ namespace Tnb.ProductionMgr
public async Task InstockTubeOne(PrdReport prdReport)
{
ISqlSugarClient db = _repository.AsSugarClient();
- string location_code = "JMXHC-01";
- string warehouse_id = "26103348825381";
+ string location_code = "ZCR01";//todo 短管挤出件目标库位之后改
+ string warehouse_id = "2";
+
+ PrdInstockH? prdInstockH = null;
+ List prdInstockDs = new() { };
+ DbResult result2 = new();
+ BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdReport.material_id);
+ DbResult result = await db.Ado.UseTranAsync(async () =>
+ {
+ OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode);
+ OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode);
+
+ prdInstockH = new PrdInstockH()
+ {
+ bill_type = DictConst.CHANCHENGPINRUKUDAN,
+ bill_date = DateTime.Now,
+ create_id = _userManager.UserId,
+ location_code = location_code,
+ carry_code = prdReport.material_box_code,
+ is_check = 1,
+ station_id = prdReport.station,
+ workline_id = workline?.Id ?? "",
+ workshop_id = workshop?.Id ?? "",
+ org_id = _userManager.GetUserInfo().Result.organizeId,
+ warehouse_id = warehouse_id,
+ status = 0,
+ };
+
+ prdInstockDs.Add(new PrdInstockD()
+ {
+ instock_id = prdInstockH.id,
+ report_id = prdReport.create_id,
+ material_id = prdReport.material_id,
+ material_code = basMaterial.code,
+ unit_id = prdReport.unit_id,
+ barcode = prdReport.barcode,
+ code_batch = prdReport.barcode + "0001",
+ quantity = (int)prdReport.reported_qty,
+ });
+ });
+
+ if (result.IsSuccess)
+ {
+ MESCreateInstockInput mesCreateInstockInput = new()
+ {
+ instock = new MESWmsInstockHInput()
+ {
+ org_id = _userManager.GetUserInfo().Result.organizeId,
+ bill_date = DateTime.Now,
+ bill_type = DictConst.CHANCHENGPINRUKUDAN,
+ warehouse_id = warehouse_id,
+ source_id = prdInstockH.id,
+ create_id = _userManager.UserId,
+ carry_code = prdReport.material_box_code,
+ location_code = location_code,
+ is_check = 1,
+ },
+ instockds = new List(),
+ instockcodes = new List()
+ };
+ mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput()
+ {
+ material_id = prdReport.material_id,
+ material_code = basMaterial.code,
+ unit_id = prdReport.unit_id,
+ code_batch = prdReport.barcode,
+ pr_qty = (int)prdReport.reported_qty,
+ });
+
+ mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput()
+ {
+ material_id = prdReport.material_id,
+ material_code = basMaterial.code,
+ unit_id = prdReport.unit_id,
+ barcode = prdReport.barcode,
+ code_batch = prdReport.barcode + "0001",
+ codeqty = (int)prdReport.reported_qty,
+ });
+ string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
+ Dictionary header = new()
+ {
+ ["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
+ };
+ string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header);
+ Log.Information(sendResult);
+ AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult);
+ result2 = authResponse.code != 200 || !authResponse.data.ObjToBool()
+ ? throw Oops.Bah(authResponse.msg)
+ : await db.Ado.UseTranAsync(async () =>
+ {
+ _ = await _repository.InsertAsync(prdInstockH);
+
+ if (prdInstockDs.Count > 0)
+ {
+ _ = await db.Insertable(prdInstockDs).ExecuteCommandAsync();
+ }
+ });
+ }
+
+ return result2.IsSuccess ? "true" : "false";
+ }
+
+ ///
+ /// 长管管挤出入库申请
+ ///
+ ///
+ ///
+ public async Task InstockTubeThree(PrdReport prdReport)
+ {
+ ISqlSugarClient db = _repository.AsSugarClient();
+ string location_code = prdReport.location_code;
+ string warehouse_id = "27209786980373";//长件挤出缓存仓
PrdInstockH? prdInstockH = null;
List prdInstockDs = new() { };
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs
index e6a66826..b6141638 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs
@@ -360,6 +360,11 @@ namespace Tnb.ProductionMgr
_ = await db.Insertable(list).ExecuteCommandAsync();
});
}
+
+ if (result.ErrorMessage == "存在不属于生产bom的投入物料,确认签收吗")
+ {
+ return "存在不属于生产bom的投入物料,确认签收吗";
+ }
return !result.IsSuccess
? throw Oops.Bah(result.ErrorMessage)
: !result2.IsSuccess ? throw Oops.Bah(result2.ErrorMessage) : (dynamic)"签收成功";
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
index d15877e2..ab3d127c 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs
@@ -1723,6 +1723,12 @@ namespace Tnb.ProductionMgr
string resultMsg = await _prdInstockService.InstockTubeOne(report);
return resultMsg == "true" ? (dynamic)true : throw Oops.Bah(resultMsg);
}
+
+ if (arr.Length > 0 && arr.Contains("CGJCJ"))//短管挤出件入库申请
+ {
+ string resultMsg = await _prdInstockService.InstockTubeThree(report);
+ return resultMsg == "true" ? (dynamic)true : throw Oops.Bah(resultMsg);
+ }
}
}
diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs
index 1ba42f52..a725cbe2 100644
--- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs
+++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs
@@ -251,7 +251,7 @@ namespace Tnb.ProductionMgr
try
{
var db = _repository.AsSugarClient();
- string warehouse_id = "26103348825381";//二楼缓存仓
+ string warehouse_id = "27209786980373";//长件挤出缓存仓
MESCreateOutstockInput input = new MESCreateOutstockInput();
input.outstock = new MESWmsOutstockHInput();