|
@@ -34,15 +34,15 @@ namespace SCADA_DAQ.Customer.Service
|
|
|
public RpcResponse<object> AddEditInventoryTableRow(int action, AppBCInventoryVo row)
|
|
|
{
|
|
|
var res = new RpcResponse<object>();
|
|
|
- var list = Env.DAL.App_BC_Inventory.GetData<App_BC_Inventory>(t => t.WarehouseCode_Str == row.WarehouseCode && t.ItemCode_Str == row.ItemCode);
|
|
|
- if (list != null && list.Count > 0)
|
|
|
- {
|
|
|
- res.IsSucceed = false;
|
|
|
- res.Message = $"已存在 仓库{row.WarehouseCode}物料号{row.ItemCode}, 修改货架号即可";
|
|
|
- return res;
|
|
|
- }
|
|
|
if (action == 1)
|
|
|
{
|
|
|
+ var list = Env.DAL.App_BC_Inventory.GetData<App_BC_Inventory>(t => t.WarehouseCode_Str == row.WarehouseCode && t.ItemCode_Str == row.ItemCode);
|
|
|
+ if (list != null && list.Count > 0)
|
|
|
+ {
|
|
|
+ res.IsSucceed = false;
|
|
|
+ res.Message = $"已存在 仓库{row.WarehouseCode}物料号{row.ItemCode}, 修改货架号即可";
|
|
|
+ return res;
|
|
|
+ }
|
|
|
var ok = Env.DAL.App_BC_Inventory.Insert(
|
|
|
new UpdateItem(T_Col_Name.App_BC_Inventory.ItemName_Str, row.ItemName),
|
|
|
new UpdateItem(T_Col_Name.App_BC_Inventory.ItemCode_Str, row.ItemCode),
|
|
@@ -99,6 +99,47 @@ namespace SCADA_DAQ.Customer.Service
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
+ public RpcResponse<object> MoveInventory(MoveInventoryVo moveInventory)
|
|
|
+ {
|
|
|
+ var res = new RpcResponse<object>();
|
|
|
+ var toInventoryList = Env.DAL.App_BC_Inventory.GetData<AppBCInventoryModel>(t => t.ItemCode == moveInventory.ItemCode && t.WarehouseCode == moveInventory.ToWarehouseCode);
|
|
|
+ List<AppBCInventoryModel> inventoryList;
|
|
|
+ if (toInventoryList != null && toInventoryList.Count == 0)
|
|
|
+ {
|
|
|
+ res.IsSucceed = false;
|
|
|
+ res.Message = $"不存在仓库{moveInventory.ToWarehouseCode} 物料号{moveInventory.ItemCode}, 请添加";
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ inventoryList = new List<AppBCInventoryModel>()
|
|
|
+ {
|
|
|
+ new AppBCInventoryModel
|
|
|
+ {
|
|
|
+ ItemCode = moveInventory.ItemCode,
|
|
|
+ WarehouseCode = moveInventory.FromWarehouseCode,
|
|
|
+ Qty = moveInventory.FormQty - moveInventory.MoveQty,
|
|
|
+ },
|
|
|
+ new AppBCInventoryModel{
|
|
|
+ ItemCode = moveInventory.ItemCode,
|
|
|
+ WarehouseCode = moveInventory.ToWarehouseCode,
|
|
|
+ Qty = toInventoryList[0].Qty + moveInventory.MoveQty,
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ var dbres = Env.DAL.BatchUpdateOrInsert(
|
|
|
+ inventoryList,
|
|
|
+ t => new { t.ItemCode, t.WarehouseCode }, //更新条件
|
|
|
+ null,
|
|
|
+ t => new { t.Qty } //更新字段
|
|
|
+ ); //批量更新
|
|
|
+ if (dbres == true)
|
|
|
+ {
|
|
|
+ res.Message = "移动成功";
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
// 获取二维图
|
|
|
//public RpcResponse<object> GetInventoryView(int row)
|
|
|
//{
|