|
|
@@ -139,7 +139,6 @@ namespace MeterSceneLibrary
|
|
|
// 不存在有效的一次计量数据
|
|
|
if (firstList == null || firstList.Count == 0)
|
|
|
{
|
|
|
-
|
|
|
// 历史皮重验证
|
|
|
rt = saveMethod.validHisTare();
|
|
|
|
|
|
@@ -156,6 +155,10 @@ namespace MeterSceneLibrary
|
|
|
// 重量类型为皮重且在皮重误差外
|
|
|
else if (list[0].weightTypeNo == "001033002" && PbCache.monitorResult.valid_wgt == false)
|
|
|
{
|
|
|
+ if (PbCache.ResultMessage == "")
|
|
|
+ {
|
|
|
+ PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
|
|
|
+ }
|
|
|
rt = saveMethod.doError(PbCache.ResultMessage);
|
|
|
rt.isWarn = true;
|
|
|
rt.WarnContent = "validWgt";
|
|
|
@@ -163,7 +166,11 @@ namespace MeterSceneLibrary
|
|
|
// 重量类型为毛重,在皮重误差内
|
|
|
else if (list[0].weightTypeNo == "001033001" && PbCache.monitorResult.valid_wgt == true)
|
|
|
{
|
|
|
- rt = saveMethod.doError("当次重量类型为毛重,在皮重误差内");
|
|
|
+ if (PbCache.ResultMessage == "")
|
|
|
+ {
|
|
|
+ PbCache.ResultMessage = "重量类型为毛重,在皮重误差内";
|
|
|
+ }
|
|
|
+ rt = saveMethod.doError(PbCache.ResultMessage);
|
|
|
rt.isWarn = true;
|
|
|
rt.WarnContent = "validWgt";
|
|
|
}
|
|
|
@@ -199,15 +206,51 @@ namespace MeterSceneLibrary
|
|
|
{
|
|
|
if (rmT.Data != null && rmT.Data.Count > 0)
|
|
|
{
|
|
|
- // 存在使用期限皮重权限,并使用期限皮重洁净
|
|
|
- List<string> l = new List<string>();
|
|
|
- l.Add("create");
|
|
|
- //给一次数据匹配委托
|
|
|
- EntityBase<PreTrackScale> entityBase1 = new EntityBase<PreTrackScale>();
|
|
|
- mwaf = entityBase1.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
- mwaf.isPreScale = "1";
|
|
|
-
|
|
|
- rt = saveMethod.doNetTermTare(rmScale.Data[0], mwaf);
|
|
|
+ // 判断收发货单位是否具有期限皮重权限
|
|
|
+ MeterBaseUnitInfoService meterBaseUnitInfoService = new MeterBaseUnitInfoService();
|
|
|
+ MeterBaseUnitInfo meterBaseUnitInfo = new MeterBaseUnitInfo();
|
|
|
+ meterBaseUnitInfo.forwardingUnitName = rmScale.Data[0].forwardingUnitName;
|
|
|
+ meterBaseUnitInfo.forwardingUnitNo = rmScale.Data[0].forwardingUnitNo;
|
|
|
+ meterBaseUnitInfo.receivingUnitName = rmScale.Data[0].receivingUintName;
|
|
|
+ meterBaseUnitInfo.receivingUnitNo = rmScale.Data[0].receivingUintNo;
|
|
|
+ RESTfulResult<List<MeterBaseUnitInfo>> tareUnitResult = meterBaseUnitInfoService.doQueryWf(meterBaseUnitInfo);
|
|
|
+ if (tareUnitResult.Succeed)
|
|
|
+ {
|
|
|
+ if (tareUnitResult.Data == null || tareUnitResult.Data.Count == 0)
|
|
|
+ {
|
|
|
+ mwaf.weightType = "0";
|
|
|
+ // 只保存一次计量数据
|
|
|
+ rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MeterBaseTermTareDataService meterBaseTermTareDataService = new MeterBaseTermTareDataService();
|
|
|
+ RESTfulResult<List<MeterBaseTermTareData>> termTareData = meterBaseTermTareDataService.doQueryPageWf(new MeterBaseTermTareData { carNo = PbCache.lockCarNo, valueFlag = "0" });
|
|
|
+ if (termTareData.Succeed)
|
|
|
+ {
|
|
|
+ if (termTareData.Data == null || termTareData.Data.Count == 0)
|
|
|
+ {
|
|
|
+ mwaf.weightType = "0";
|
|
|
+ // 只保存一次计量数据
|
|
|
+ rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
|
|
|
+ PbCache.ResultMessage = "计量成功,期限皮不存在或者已过期,请留存期限皮";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 存在使用期限皮重权限,并使用期限皮重洁净
|
|
|
+ List<string> l = new List<string>();
|
|
|
+ l.Add("create");
|
|
|
+ //给一次数据匹配委托
|
|
|
+ EntityBase<PreTrackScale> entityBase1 = new EntityBase<PreTrackScale>();
|
|
|
+ mwaf = entityBase1.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
+ mwaf.isPreScale = "1";
|
|
|
+ mwaf.weightType = "0";
|
|
|
+
|
|
|
+ rt = saveMethod.doNetTermTare(rmScale.Data[0], mwaf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -240,21 +283,34 @@ namespace MeterSceneLibrary
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt < 0 || listMonitor.Data[0].validPredictionDiff == "0")
|
|
|
+ // 当次重量和上次重量满足洁净最小值条件
|
|
|
+ if (Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) > diffrentWgt || listMonitor.Data[0].validPredictionDiff == "0")
|
|
|
{
|
|
|
- if (list[0].weightTypeNo == "001033001")
|
|
|
+ //判断上一次的一次数据是为皮重的,这次为毛重,上一次重量比这一次大;
|
|
|
+ //上一次为皮重4200,这一次是毛重3200
|
|
|
+ if (firstList[0].weightType == "1" && list[0].weightTypeNo == "001033001" && rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt > 0)
|
|
|
{
|
|
|
+ EntityBase<PreTrackScale> entityBase1 = new EntityBase<PreTrackScale>();
|
|
|
+ mwaf = entityBase1.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
mwaf.weightType = "0";
|
|
|
+ mwaf.isPreScale = "1";
|
|
|
+ mwaf.actualFirstNo = "";
|
|
|
+
|
|
|
+ rt = saveMethod.doNetError(rmScale.Data[0], firstList[0], mwaf, mwaf);
|
|
|
+ return rt;
|
|
|
}
|
|
|
- else if (list[0].weightTypeNo == "001033002")
|
|
|
+ //判断上一次的一次数据是为毛重的,这次为皮重,上一次重量比这一次小;
|
|
|
+ if (firstList[0].weightType == "0" && list[0].weightTypeNo == "001033002" && rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt < 0)
|
|
|
{
|
|
|
+ EntityBase<PreTrackScale> entityBase1 = new EntityBase<PreTrackScale>();
|
|
|
+ mwaf = entityBase1.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
mwaf.weightType = "1";
|
|
|
+ mwaf.isPreScale = "1";
|
|
|
+ mwaf.actualFirstNo = "";
|
|
|
+
|
|
|
+ rt = saveMethod.doNetError(rmScale.Data[0], mwaf, firstList[0], mwaf);
|
|
|
+ return rt;
|
|
|
}
|
|
|
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
|
|
|
- }
|
|
|
- // 当次重量和上次重量满足洁净最小值条件
|
|
|
- else if (Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) > diffrentWgt || listMonitor.Data[0].validPredictionDiff == "0")
|
|
|
- {
|
|
|
// 查询当前秤点是否启用历史皮重判断(暂时不考虑此限制)By BourneCao
|
|
|
// String spotNo = PbCache.sportInfo.baseSpotNo;
|
|
|
// 历史皮重验证
|
|
|
@@ -275,6 +331,10 @@ namespace MeterSceneLibrary
|
|
|
// 重量类型为皮重且不在皮重误差内
|
|
|
else if (list[0].weightTypeNo == "001033002" && PbCache.monitorResult.valid_wgt == false)
|
|
|
{
|
|
|
+ if (PbCache.ResultMessage == "")
|
|
|
+ {
|
|
|
+ PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
|
|
|
+ }
|
|
|
rt = saveMethod.doError(PbCache.ResultMessage);
|
|
|
}
|
|
|
// 重量类型为毛重,不在皮重误差内,正常结净
|
|
|
@@ -284,22 +344,129 @@ namespace MeterSceneLibrary
|
|
|
{
|
|
|
mwaf.weightType = "0";
|
|
|
rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
|
|
|
+ PbCache.ResultMessage = "无皮重信息,无法结净,请计量皮重";
|
|
|
+ rt.isWarn = true;
|
|
|
+ rt.WarnContent = "validWgt";
|
|
|
}
|
|
|
- else
|
|
|
+ else if(firstList[0].weightType == "1")
|
|
|
{
|
|
|
- // 正常结净
|
|
|
- //给一次数据匹配委托
|
|
|
- EntityBase<PreTrackScale> entityBase1 = new EntityBase<PreTrackScale>();
|
|
|
- mwaf = entityBase1.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
- mwaf.isPreScale = "1";
|
|
|
+ // 判断车辆是否具有期限皮重权限
|
|
|
+ MeterBaseTermTareCarService meterBaseTermTareCarService = new MeterBaseTermTareCarService();
|
|
|
+ RESTfulResult<List<MeterBaseTermTareCar>> tareCarResult = meterBaseTermTareCarService.doQueryWf(new MeterBaseTermTareCar { carNo = PbCache.lockCarNo, valueFlag = "0" });
|
|
|
|
|
|
- rt = saveMethod.doNet(rmScale.Data[0], firstList[0], mwaf);
|
|
|
+ if (tareCarResult.Succeed)
|
|
|
+ {
|
|
|
+ // 没有期限皮重权限
|
|
|
+ if (tareCarResult.Data == null || tareCarResult.Data.Count == 0)
|
|
|
+ {
|
|
|
+ // 正常结净
|
|
|
+ //给一次数据匹配委托
|
|
|
+ EntityBase<PreTrackScale> entityBase1 = new EntityBase<PreTrackScale>();
|
|
|
+ mwaf = entityBase1.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
+ mwaf.isPreScale = "1";
|
|
|
+ mwaf.weightType = "0";
|
|
|
+
|
|
|
+ rt = saveMethod.doNet(rmScale.Data[0], firstList[0], mwaf);
|
|
|
+ }
|
|
|
+ // 有期限皮重权限
|
|
|
+ else if (tareCarResult.Data.Count >= 1)
|
|
|
+ {
|
|
|
+ //查下当前拖的物料是否可用期限皮;验证业务类型是否允许使用期限皮重
|
|
|
+ string sqls = @"select t.matter_no id, t.matter_name text
|
|
|
+ from meter_base_matter_info t,meter_base_metertype_conf t2
|
|
|
+ where t.allowed_tare_weight = '1'
|
|
|
+ and t.valid_flag = '1'
|
|
|
+ and t.matter_no='" + rmScale.Data[0].matterNo + @"'
|
|
|
+ and t2.is_allow_term_tare = '1' and t2.meter_type_no = '" + rmScale.Data[0].meterTypeNo + @"'";
|
|
|
+
|
|
|
+ PbModelDbService<List<PbModelDb>> pbp = new PbModelDbService<List<PbModelDb>>();
|
|
|
+ RESTfulResult<List<PbModelDb>> rmT = pbp.executeSqlDataWf(sqls);
|
|
|
+ if (rmT.Succeed)
|
|
|
+ {
|
|
|
+ // 存在使用期限皮重权限,并使用期限皮重洁净
|
|
|
+ if (rmT.Data != null && rmT.Data.Count > 0)
|
|
|
+ {
|
|
|
+ // 判断收发货单位是否具有期限皮重权限
|
|
|
+ MeterBaseUnitInfoService meterBaseUnitInfoService = new MeterBaseUnitInfoService();
|
|
|
+ MeterBaseUnitInfo meterBaseUnitInfo = new MeterBaseUnitInfo();
|
|
|
+ meterBaseUnitInfo.forwardingUnitName = rmScale.Data[0].forwardingUnitName;
|
|
|
+ meterBaseUnitInfo.forwardingUnitNo = rmScale.Data[0].forwardingUnitNo;
|
|
|
+ meterBaseUnitInfo.receivingUnitName = rmScale.Data[0].receivingUintName;
|
|
|
+ meterBaseUnitInfo.receivingUnitNo = rmScale.Data[0].receivingUintNo;
|
|
|
+ meterBaseUnitInfo.allowedTareWeight = "1";
|
|
|
+ RESTfulResult<List<MeterBaseUnitInfo>> tareUnitResult = meterBaseUnitInfoService.doQueryWf(meterBaseUnitInfo);
|
|
|
+ if (tareUnitResult.Succeed)
|
|
|
+ {
|
|
|
+ MeterBaseTermTareDataService meterBaseTermTareDataService = new MeterBaseTermTareDataService();
|
|
|
+ RESTfulResult<List<MeterBaseTermTareData>> termTareData = meterBaseTermTareDataService.doQueryPageWf(new MeterBaseTermTareData { carNo = PbCache.lockCarNo, valueFlag = "0" });
|
|
|
+ if (termTareData.Succeed)
|
|
|
+ {
|
|
|
+ //判断是否存在未过期的期限皮重
|
|
|
+ if (termTareData.Data == null || termTareData.Data.Count == 0)
|
|
|
+ {
|
|
|
+ if (tareUnitResult.Data == null || tareUnitResult.Data.Count == 0)
|
|
|
+ {
|
|
|
+ // 正常结净
|
|
|
+ //给一次数据匹配委托
|
|
|
+ EntityBase<PreTrackScale> entityBase3 = new EntityBase<PreTrackScale>();
|
|
|
+ mwaf = entityBase3.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
+ mwaf.isPreScale = "1";
|
|
|
+ mwaf.weightType = "0";
|
|
|
+
|
|
|
+ rt = saveMethod.doNet(rmScale.Data[0], firstList[0], mwaf);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 正常结净
|
|
|
+ //给一次数据匹配委托
|
|
|
+ EntityBase<PreTrackScale> entityBase3 = new EntityBase<PreTrackScale>();
|
|
|
+ mwaf = entityBase3.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
+ mwaf.isPreScale = "1";
|
|
|
+ mwaf.weightType = "0";
|
|
|
+
|
|
|
+ rt = saveMethod.doTermTareNet(rmScale.Data[0], firstList[0], mwaf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 存在使用期限皮重权限,并使用期限皮重洁净
|
|
|
+ List<string> l = new List<string>();
|
|
|
+ l.Add("create");
|
|
|
+ //给一次数据匹配委托
|
|
|
+ EntityBase<PreTrackScale> entityBase1 = new EntityBase<PreTrackScale>();
|
|
|
+ mwaf = entityBase1.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
+ mwaf.isPreScale = "1";
|
|
|
+ mwaf.weightType = "0";
|
|
|
+
|
|
|
+ rt = saveMethod.doNetTermTare(rmScale.Data[0], mwaf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // 正常结净
|
|
|
+ //给一次数据匹配委托
|
|
|
+ EntityBase<PreTrackScale> entityBase2 = new EntityBase<PreTrackScale>();
|
|
|
+ mwaf = entityBase2.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
+ mwaf.isPreScale = "1";
|
|
|
+ mwaf.weightType = "0";
|
|
|
+
|
|
|
+ rt = saveMethod.doNet(rmScale.Data[0], firstList[0], mwaf);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
// 重量类型为毛重,在皮重误差内
|
|
|
else if (list[0].weightTypeNo == "001033001" && PbCache.monitorResult.valid_wgt == true)
|
|
|
{
|
|
|
+ if (PbCache.ResultMessage == "")
|
|
|
+ {
|
|
|
+ PbCache.ResultMessage = "重量类型为毛重,在皮重误差内";
|
|
|
+ }
|
|
|
rt = saveMethod.doError(PbCache.ResultMessage);
|
|
|
}
|
|
|
}
|
|
|
@@ -325,18 +492,16 @@ namespace MeterSceneLibrary
|
|
|
//多条一次记录下判断是否全为毛重,是全部结净
|
|
|
if (firstList[firstList.Count-1].weightType == "0" && list[0].weightTypeNo == "001033002")
|
|
|
{
|
|
|
- //给一次数据匹配委托
|
|
|
- EntityBase<PreTrackScale> entityBase = new EntityBase<PreTrackScale>();
|
|
|
- mwaf = entityBase.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
|
|
|
- mwaf.isPreScale = "1";
|
|
|
- mwaf.weightType = "0";
|
|
|
-
|
|
|
- rt = saveMethod.doNetAddMuch(mwaf);
|
|
|
+ mwaf.weightType = "1";
|
|
|
+ rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
|
|
|
}
|
|
|
else if (firstList[firstList.Count - 1].weightType == "0" && list[0].weightTypeNo == "001033001")
|
|
|
{
|
|
|
mwaf.weightType = "0";
|
|
|
rt = saveMethod.doAddFirst(rmScale.Data[0],mwaf);
|
|
|
+ PbCache.ResultMessage = "无皮重信息,无法结净,请计量皮重";
|
|
|
+ rt.isWarn = true;
|
|
|
+ rt.WarnContent = "validWgt";
|
|
|
}
|
|
|
else
|
|
|
{
|