Commit 9675ffb0 by Seniorious

1

parent 65b783c8
......@@ -74,7 +74,7 @@ namespace APIs.Controllers
private readonly DehumidifierHelper _dehumidifierHelper;
public BaseInfoController(IMapper mapper, DehumidifierHelper dehumidifierHelper, IPoliceService policeService, IEquipmentTypeService equipmentTypeService,
IEquipmentSizeService equipmentSizeService,ICarService carService, IInventoryService inventoryService,
IEquipmentSizeService equipmentSizeService, ICarService carService, IInventoryService inventoryService,
IInvService invService, IUsersService usersService, ILogService logService, IDevHistoryService devHistoryService,
IDevService devService, IWarehouseService warehouseService, IOrderService orderService, ISupplierService supplierService,
IThisInfoService thisInfoService, IPrintService printService, IPoliceFingerService policeFingerService, IPoliceInfoService policeInfoService,
......@@ -178,7 +178,6 @@ namespace APIs.Controllers
{
try
{
#region
if (string.IsNullOrEmpty(req.warehouseId))
{
return new ApiResult
......@@ -187,7 +186,68 @@ namespace APIs.Controllers
msg = "参数不正确",
};
}
if(await _orderService.QueryOne(s => s.orderState != 1 && s.bussinessType.Equals("purchase")) != null)
var orders = await _bussinessInventoryService.Query(s => s.warehouseId.Equals(req.warehouseId) && s.inventoryState.Equals("waitting"));
if (!orders.Any()) return new ApiResult
{
code = ResultCode.OPERATE_SUCCESS.Code,
msg = "无可用单据",
};
var rs = orders.Select(s => new
{
id = s.id,
orderNum = s.orderNum,
year = s.year,
month = s.month,
applyTime = s.applyTime,
createTime = s.createTime,
warehouseId= s.warehouseId,
warehouseName=s.warehouseName,
}).ToList();
var src = new ApiResult
{
code = ResultCode.OPERATE_SUCCESS.Code,
msg = ResultCode.OPERATE_SUCCESS.Msg,
data = rs,
};
return src;
}
catch (Exception ex)
{
var error = new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = ex.Message,
};
return error;
}
}
/// <summary>
/// 手持机开启盘点单据
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult> StartInventoryOrder([FromBody] StartInventoryOrderReq req)
{
try
{
#region
if (string.IsNullOrEmpty(req.orderId))
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "参数不正确",
};
}
if (await _orderService.QueryOne(s => s.orderState != 1 && s.bussinessType.Equals("purchase")) != null)
{
return new ApiResult
{
......@@ -206,10 +266,17 @@ namespace APIs.Controllers
}
#endregion
var BIOrderMain = await _bussinessInventoryService.QueryOneOrderDesc(s => s.warehouseId.Equals(req.warehouseId) && s.inventoryState.Equals("waitting"), c => c.createTime);
var BIOrderMain = await _bussinessInventoryService.QueryOne(s => s.id == Convert.ToInt64(req.orderId));
if (BIOrderMain == null) return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "不存在此单据",
};
BussinessInventory? rs = await _bussinessInventoryService.GenerateInventoryOrder(BIOrderMain);
if(rs == null)
if (rs == null)
{
return new ApiResult
{
......@@ -253,7 +320,7 @@ namespace APIs.Controllers
{
code = ResultCode.OPERATE_SUCCESS.Code,
msg = ResultCode.OPERATE_SUCCESS.Msg,
data = JsonConvert.SerializeObject(rs),
data = rs,
};
return src;
......@@ -271,7 +338,7 @@ namespace APIs.Controllers
}
/// <summary>
/// 手持机上传单据操作结果
/// 手持机上传单据操作结果(弃用)
/// </summary>
/// <returns></returns>
[HttpPost]
......@@ -304,7 +371,7 @@ namespace APIs.Controllers
{
code = ResultCode.OPERATE_SUCCESS.Code,
msg = ResultCode.OPERATE_SUCCESS.Msg,
}: new ApiResult
} : new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "数据更新失败",
......@@ -322,7 +389,7 @@ namespace APIs.Controllers
}
/// <summary>
/// 手持机获取单据
/// 手持机获取单据(弃用)
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
......@@ -376,7 +443,7 @@ namespace APIs.Controllers
var types = await _equipmentTypeService.Query();
var sizes = await _equipmentSizeService.Query();
var rs = sizes.Select(s => new { s.id, s.typeId, s.name, s.code, typeName = types.FirstOrDefault(x => s.typeId.Equals(x.id))?.name}).ToList();
var rs = sizes.Select(s => new { s.id, s.typeId, s.name, s.code, typeName = types.FirstOrDefault(x => s.typeId.Equals(x.id))?.name }).ToList();
var src = new ApiResult
{
......@@ -415,7 +482,8 @@ namespace APIs.Controllers
code = ResultCode.OPERATE_SUCCESS.Code,
msg = "无效参数",
};
}else if (string.IsNullOrEmpty(req.policeId))
}
else if (string.IsNullOrEmpty(req.policeId))
{
return new ApiResult
{
......@@ -553,7 +621,7 @@ namespace APIs.Controllers
{
try
{
if(req == null)
if (req == null)
{
return new ApiResult
{
......@@ -672,7 +740,7 @@ namespace APIs.Controllers
};
}
if(req.warehouseId == null)
if (req.warehouseId == null)
{
return new ApiResult
{
......@@ -682,7 +750,7 @@ namespace APIs.Controllers
}
#endregion
if(await _bussinessInventoryService.QueryOne(s => s.inventoryState.Equals("running")) != null)
if (await _bussinessInventoryService.QueryOne(s => s.inventoryState.Equals("running")) != null)
{
return new ApiResult
{
......@@ -718,7 +786,7 @@ namespace APIs.Controllers
{
warehouseInvtory = warehouseInvtory.Where(s => !(s.bussinessState.Equals("repair") && s.state.Equals("1"))).ToList();
}
else if(!(myOrder.bussinessType.Equals("repair") && myOrder.orderType.Equals("in")))
else if (!(myOrder.bussinessType.Equals("repair") && myOrder.orderType.Equals("in")))
{
warehouseInvtory = warehouseInvtory.Where(s => !(s.bussinessState.Equals("repair") && s.state.Equals("1"))).ToList();
}
......@@ -758,7 +826,7 @@ namespace APIs.Controllers
}
var deatilDic = myOrder?.DetailList.Where(s => s.warehouseId.Equals(req.warehouseId))
.Select(s =>s.equipmentSize)
.Select(s => s.equipmentSize)
.ToList();//通道所在仓库子单
//创建出入库记录
......@@ -785,13 +853,13 @@ namespace APIs.Controllers
if (mytype != null && mysize != null)
{
if(myOrder != null && deatilDic != null)//单据出入库则过滤非单据装备
if (myOrder != null && deatilDic != null)//单据出入库则过滤非单据装备
{
if(!deatilDic.Contains(mysize.id))
if (!deatilDic.Contains(mysize.id))
{
continue;
}
else if(newEquOrderType.Contains(myOrder.bussinessType) && myOrder.orderType.Equals("in"))//有新装备单据生成库存记录
else if (newEquOrderType.Contains(myOrder.bussinessType) && myOrder.orderType.Equals("in"))//有新装备单据生成库存记录
{
var periodInfo = (await _printService.QueryOne(s => s.id.Equals(myOrder.id)))?.DetailList.FirstOrDefault(s => s.sizeId.Equals(mysize.id));
newEquList.Add(new Inventory
......@@ -819,6 +887,7 @@ namespace APIs.Controllers
createTime = DateTime.Now,
updateTime = DateTime.Now,
price = myOrder.DetailList?.FirstOrDefault(s => s.equipmentSize.Equals(mysize.id))?.price ?? 0,
property = Convert.ToInt32(epc_info.EProperty),
});
}
}
......@@ -842,9 +911,10 @@ namespace APIs.Controllers
price = inv == null ? (myOrder.DetailList?.FirstOrDefault(s => s.equipmentSize.Equals(mysize.id))?.price ?? 0) : (inv?.price ?? 0),
createTime = DateTime.Now,
updateTime = DateTime.Now,
property = Convert.ToInt32(epc_info.EProperty),
});
if(warrantyList != null && warrantyList.Contains(epc))
if (warrantyList != null && warrantyList.Contains(epc))
{
string thisKey = $"{mysize.id}||{mytype?.name}({mysize.name})";
if (warrantyDic.TryGetValue(thisKey, out int va))
......@@ -908,7 +978,7 @@ namespace APIs.Controllers
foreach (var item in warrantyDic)
{
var name = item.Key.Split(new string[] { "||" }, StringSplitOptions.None).Skip(1).FirstOrDefault();
msg += $"{name}{item.Value}件,";
msg += $"{name} {item.Value}件,";
};
msg = msg.Substring(0, msg.Length - 1);
}
......@@ -949,21 +1019,23 @@ namespace APIs.Controllers
{
try
{
if(req == null)
if (req == null)
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "参数错误",
};
}else if(string.IsNullOrEmpty(req.policeId))
}
else if (string.IsNullOrEmpty(req.policeId))
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "警员编号为空",
};
}else if(req.fingerList == null || req.fingerList.Count() == 0)
}
else if (req.fingerList == null || req.fingerList.Count() == 0)
{
return new ApiResult
{
......@@ -973,14 +1045,15 @@ namespace APIs.Controllers
}
var police = await _policeInfoService.QueryOne(s => s.id.Equals(req.policeId));
if(police == null)
if (police == null)
{
return new ApiResult
{
code = ResultCode.OPERATE_FAILED.Code,
msg = "无警员信息",
};
}else
}
else
{
var send = new
{
......@@ -990,7 +1063,7 @@ namespace APIs.Controllers
var json = HttpHelper.HttpPost(/*AdminGlobalContext.jyzbConfig.Url*/"http://192.168.2.14:10030" + "/PolicemanFinger/insertOrUpdateFingerInfo", JsonConvert.SerializeObject(send));
var httprs = JsonConvert.DeserializeObject<HttpHelper.res<string>>(json);
if(httprs != null && httprs.code == "99200")
if (httprs != null && httprs.code == "99200")
{
var rs = await _policeFingerService.UpdateFinger(req.policeId, req.fingerList);
......@@ -1106,7 +1179,7 @@ namespace APIs.Controllers
{
try
{
if(req.picture == null)
if (req.picture == null)
{
return new ApiResult
{
......@@ -1405,7 +1478,7 @@ namespace APIs.Controllers
{
var police = await _policeService.QueryOne(p => p.id.Equals(req.id));
if(police == null)
if (police == null)
{
var error = new ApiResult
{
......@@ -1629,7 +1702,7 @@ namespace APIs.Controllers
}
int result= _policeService.UpdateObjs(police);
int result = _policeService.UpdateObjs(police);
if (result > 0)
{
var src = new ApiResult
......@@ -1640,7 +1713,8 @@ namespace APIs.Controllers
};
return src;
}
else {
else
{
var src = new ApiResult
{
code = ResultCode.POLICE_ERROR.Code,
......@@ -1692,7 +1766,7 @@ namespace APIs.Controllers
{
reqTime = DateTime.Parse(req.updateTime);
}
var police = await _policeService.Query(p=>p.updateTime>= reqTime);
var police = await _policeService.Query(p => p.updateTime >= reqTime);
var src = new ApiResult
{
code = ResultCode.OPERATE_SUCCESS.Code,
......@@ -1731,13 +1805,13 @@ namespace APIs.Controllers
reqTime = DateTime.Parse(req.updateTime);
}
var typeQuery = await _equipmentTypeService.Query(p => p.updateTime >= reqTime);
List<EquipmentTypeDto> typeDto = new List<EquipmentTypeDto>() ;
List<EquipmentTypeDto> typeDto = new List<EquipmentTypeDto>();
Mapper.Map(typeQuery, typeDto);
var src = new ApiResult
{
code = ResultCode.OPERATE_SUCCESS.Code,
msg = ResultCode.OPERATE_SUCCESS.Msg,
data= typeDto
data = typeDto
};
return JsonConvert.SerializeObject(src);
}
......@@ -1765,7 +1839,7 @@ namespace APIs.Controllers
try
{
DateTime reqTime= DateTime.MinValue;
DateTime reqTime = DateTime.MinValue;
if (!string.IsNullOrEmpty(req.updateTime))
{
reqTime = DateTime.Parse(req.updateTime);
......
......@@ -28,6 +28,11 @@ namespace APIs.Req
public string warehouseId { get; set; }
}
public class StartInventoryOrderReq
{
public string orderId { get; set; }
}
public class GetWarehouseConfigReq
{
public string deviceId { get; set; }
......
......@@ -333,6 +333,8 @@ namespace Common
pos += 4;
rtn.EType = (byte)GetData(epc, pos, 4);
pos += 4;
rtn.EProperty = 0;
}
else if (rtn.Ver == 0x03)
{
......
......@@ -82,5 +82,6 @@ namespace Models.Table
[SugarColumn(ColumnName = "package_id")]
public string packageId { get; set; }
public int? property { get; set; }
}
}
......@@ -59,5 +59,6 @@ namespace Models.Table
[SugarColumn(ColumnName = "price")]
public decimal? price { get; set; }
public int? property { get; set; }
}
}
......@@ -53,5 +53,8 @@ namespace Models.Table
[SugarColumn(ColumnName = "maintenance_period")]
public int? maintenancePeriod { get; set; }
[SugarColumn(ColumnName = "property")]
public int? property { get; set; }
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论