|
@@ -2141,7 +2141,36 @@ namespace wms.service.Service
|
|
|
//验证库存
|
|
|
var stock = _billnowrepository.GetFirst(p => p.ContGrpBarCode == wcstask.BarCode && p.InvStateCode == InvState.InvEcecState_BuildUp.ToString());
|
|
|
if (stock == null)
|
|
|
- {
|
|
|
+ { //砝码出库无库存信息创建组盘信息
|
|
|
+ if (wcstask.BusType == CpTaskBusType.TaskBusType_CP_WeightOut.GetDescription())
|
|
|
+ {
|
|
|
+ var stocks = _billnowrepository.AsQueryable().Where(p => p.ContGrpBarCode == wcstask.BarCode).First();
|
|
|
+ if (stocks == null)
|
|
|
+ {
|
|
|
+ var trayCode = _materrepository.GetSingle(p => p.Code == Const.TrayType);
|
|
|
+ var inv = new cpBillInvnow()
|
|
|
+ {
|
|
|
+ WarehouseId = trayCode.Id,
|
|
|
+ ContGrpBarCode = wcstask.BarCode,
|
|
|
+ ContGrpId = GetId(),
|
|
|
+ BoxBarCode = wcstask.BarCode,
|
|
|
+ InvStateCode = InvState.InvEcecState_BuildUp.ToString(),
|
|
|
+ ExecStateCode = InvLockState.InvState_Normal.ToString(),
|
|
|
+ MatId = trayCode.Id,
|
|
|
+ MatCode = "FaMa",
|
|
|
+ RFIDBarCode = wcstask.BarCode,
|
|
|
+ HWTypeCode = trayCode.SpoolType,
|
|
|
+ HWBarCode = wcstask.BarCode,
|
|
|
+ InvInOut = 1,
|
|
|
+ MatName = trayCode.Name,
|
|
|
+ Size = 1,
|
|
|
+ ContGrpType = 2,
|
|
|
+ TolWQty = 7
|
|
|
+ };
|
|
|
+ _billnowrepository.Insert(inv);
|
|
|
+ _billInvFlow.Insert(_mapper.Map<cpBillInvflow>(inv));
|
|
|
+ }
|
|
|
+ }
|
|
|
res.ResCode = ResponseStatusCodeEnum.StockNotExist.GetHashCode();
|
|
|
res.ResMsg = wcstask.BarCode + ResponseStatusCodeEnum.StockNotExist.GetDescription();
|
|
|
return res;
|
|
@@ -5390,23 +5419,26 @@ namespace wms.service.Service
|
|
|
/// <returns></returns>
|
|
|
public SRes TriggerAutoCalibration()
|
|
|
{
|
|
|
+ var hour = 10;
|
|
|
const string deviceId = "8058"; //TODO:根据实际情况设置设备ID
|
|
|
const string matCode = "FaMa";
|
|
|
var result = new SRes() { ResCode = ResponseStatusCodeEnum.Sucess.GetHashCode(), ResMsg = ResponseStatusCodeEnum.Sucess.GetDescription() };
|
|
|
var sysconfig = _sysconfigrepository.GetFirst(p => p.Code == "AutomaticCalibration");
|
|
|
var config = _sysconfigrepository.GetFirst(p => p.Code == "AutomaticCalibration").SContent;
|
|
|
|
|
|
- if (!ShouldTriggerScaleTask(config))
|
|
|
+ if (sysconfig != null && !string.IsNullOrEmpty(sysconfig.Default3))
|
|
|
+ {
|
|
|
+ hour = Convert.ToInt16(sysconfig.Default1);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!ShouldTriggerScaleTask(config, hour))
|
|
|
{
|
|
|
result.ResCode = ResponseStatusCodeEnum.EquipInfoNotExist.GetHashCode();
|
|
|
result.ResMsg = "不在可执行范围内";
|
|
|
return result;
|
|
|
}
|
|
|
- var hour = 10;
|
|
|
- if (sysconfig != null && string.IsNullOrEmpty(sysconfig.Default1))
|
|
|
- {
|
|
|
- hour = Convert.ToInt16(sysconfig.Default1);
|
|
|
- }
|
|
|
+
|
|
|
+
|
|
|
//检查今天早上十点-十点五十九之间是否执行过
|
|
|
DateTime now = DateTime.Now;
|
|
|
// 当天 10:00 开始
|
|
@@ -5546,10 +5578,10 @@ namespace wms.service.Service
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- public bool ShouldTriggerScaleTask(string config)
|
|
|
- {
|
|
|
+ public bool ShouldTriggerScaleTask(string config,int hour)
|
|
|
+ {
|
|
|
DateTime now = DateTime.Now;
|
|
|
- DateTime todayAt10 = new DateTime(now.Year, now.Month, now.Day, 10, 0, 0);
|
|
|
+ DateTime todayAt10 = new DateTime(now.Year, now.Month, now.Day, hour, 0, 0);
|
|
|
|
|
|
switch (config)
|
|
|
{
|