| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072 |
- using com.hnshituo.core.webapp.vo;
- using Common;
- using Common.DbOption.work;
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Threading.Tasks;
- namespace MeterSceneLibrary
- {
- /// <summary>
- /// 酒钢厂内车辆计量业务
- /// </summary>
- public class InnerCarJISCO
- {
- // 一次计量数据
- private MeterWorkCarActualFirstService mwcfs = new MeterWorkCarActualFirstService();
- // 重量类型预处理表
- private MeterWorkPreWgttypeService wgttypeService = new MeterWorkPreWgttypeService();
- // 车辆委托表
- private PreTrackScaleService preTrackScaleService = new PreTrackScaleService();
- // 留期限皮操作
- private MeterBaseTermTareDataService termTareDate = new MeterBaseTermTareDataService();
- private MeterBaseSpotInfoService meterBaseSpotInfoService = new MeterBaseSpotInfoService();
- private rtInfo rt = new rtInfo();
- // 构建一次计量数据
- private MeterWorkCarActualFirst mwaf = new MeterWorkCarActualFirst();
- private MeterBaseCarService carService = new MeterBaseCarService();
- private MeterBaseSpecialUnitService meterBaseSpecialUnitService = new MeterBaseSpecialUnitService();
- // 结净最小值,默认取配置文件
- private double diffrentWgt = AppConfigCache.differenceWgt;
- // 根据称点查询监控信息
- private RESTfulResult<List<MeterWorkMonitor>> listMonitor;
- // 根据车号查询委托表中未使用和使用中的委托
- private List<PreTrackScale> listPreScale;
- private JISCO.SaveMethod saveMethod = new JISCO.SaveMethod();
- public rtInfo MeterMethod(PreTrackScale scale)
- {
- Log lg = Log.GetInstance();
- rt.isError = false;
- string ResultMessage = "";
- bool isError = false;
- //根据称点查询监控信息
- MeterWorkMonitorService meterWorkMonitorService = new MeterWorkMonitorService();
- listMonitor = meterWorkMonitorService.doQueryOneWf(new MeterWorkMonitor { pointNo = PbCache.sportInfo.baseSpotNo });
- mwaf.carNo = PbCache.lockCarNo;
- mwaf.weightType = ""; // 默认重量类型为空
- mwaf.actualFirstNo = DateTime.Now.ToString("yyyyMMdd");//10
- mwaf.meterWeight = PbCache.lockWgt;//计量重量
- mwaf.addWeight = PbCache.addWgt;//附加重量
- mwaf.createManNo = "admin";
- mwaf.createManName = "admin";
- mwaf.meterGroup = "";
- mwaf.meterClass = "";
- mwaf.createManNo = "SYSTEM";
- mwaf.createManName = "system";
- mwaf.createTime = DateTime.Now;
- mwaf.baseSpotNo = PbCache.sportInfo.baseSpotNo;//计量点编号
- mwaf.baseSpotName = PbCache.sportInfo.baseSpotName;
- //mwaf.memo = "";
- mwaf.valueFlag = "1"; //状态(0 = 作废,1 = 有效(已匹配),2 = 结净)
- mwaf.updateManName = "";
- mwaf.updateManNo = "";
- mwaf.updateTime = null;
- mwaf.checkFlag = "1"; //0未审核,1已审核
- mwaf.meterMode = "2"; //1:远程计量;2:智能计量;3:手工录入;4:放行智能计量;5:滞后匹配
- mwaf.addWeight = PbCache.addWgt;
- mwaf.dataSource = "1"; //数据来源(1=智能终端,2=本地计量,3=应急计量,4=手动录入(计量票据录入))
- PbCache.isActual = false;
- PbCache.isInnerCar = false;
- PbCache.ResultMessage = "";
- PbCache.monitorResultMessage = "";
- PbCache.LEDResultMessage = "";
- PbCache.yardActual = null;
- PbCache.yardFirst = null;
- // 根据车号查询重量类型预处理表
- RESTfulResult<List<MeterWorkPreWgttype>> rmX = wgttypeService.doQueryWf(new MeterWorkPreWgttype { carNo = PbCache.lockCarNo, valueFlag = "1" });
- // 不存在未使用的重量类型数据
- if (rmX.Succeed)
- {
- List<MeterWorkPreWgttype> list = rmX.Data;
- // 不存在一次预处理数据
- if (list == null || list.Count == 0)
- {
- /* a. 程序报警
- * b. 自动进行语音求助
- */
- rt = saveMethod.doError("未选择称重类型,请选择后开始计量");
- PbCache.voiceType = 21;
- PbCache.monitorResultMessage = "未选择称重类型,请选择后开始计量";
- PbCache.LEDResultMessage = "未选择称重类型,请选择后开始计量";
- PbCache.ResultMessage = "未选择称重类型,请选择后开始计量";
- return rt;
- }
- // 存在一条预处理数据
- else if (list == null || list.Count == 1)
- {
- // 历史皮重验证
- // 001033002:皮重
- rt = saveMethod.validHisTare2(list[0].weightTypeNo);
- if (list[0].weightTypeNo == "001033002" && PbCache.monitorResult.valid_wgt == false && listMonitor.Data[0].validWgt == "1")
- {
-
- PbCache.ResultMessage = "毛皮类型选错,请重新选择";
- PbCache.LEDResultMessage = "计量失败,毛皮类型选错,请重新选择";
- PbCache.voiceType = 26;
- rt = saveMethod.doError(PbCache.ResultMessage);
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- return rt;
- }
- // 001033001:毛重
- if (list[0].weightTypeNo == "001033001" && PbCache.monitorResult.valid_wgt == true && listMonitor.Data[0].validWgt == "1")
- {
-
- PbCache.ResultMessage = "毛皮类型选错,请重新选择";
- PbCache.LEDResultMessage = "计量失败,毛皮类型选错,请重新选择";
- PbCache.voiceType = 23;
- rt = saveMethod.doError(PbCache.ResultMessage);
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- return rt;
- }
- //拿到车辆
- RESTfulResult<List<MeterBaseCar>> resCarList = carService.doQueryCarList(new MeterBaseCar { carNo = PbCache.lockCarNo });
- RESTfulResult<List<MeterBaseSpecialUnit>> sunitList = meterBaseSpecialUnitService.doQueryCarList(new MeterBaseSpecialUnit { unitNo = resCarList.Data[0].usetDepartmentNo });
- if (resCarList.Data[0].usetDepartmentNo == "888888")
- {}
- else
- {
- if (sunitList.Data == null || sunitList.Data.Count != 1)
- { }
- else
- {
- bool isGorss = rmX.Data[0].submitFlag == "1" && rmX.Data[0].weightTypeNo == "001033001";
- if (isGorss || rmX.Data[0].weightTypeNo == "001033002")
- { }
- else
- {
- rt = saveMethod.doError("");
- rt.resultInfo = string.Format("车号{0},当前毛重{1}吨,请确认重量", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.LEDResultMessage = string.Format("车号{0},当前毛重{1}吨,请确认重量", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.voiceType = 12;
- return rt;
- }
- }
- }
- // 查已选择的委托
- RESTfulResult<List<PreTrackScale>> rmScale = preTrackScaleService.doQueryByFlag(new PreTrackScale { carNo = PbCache.lockCarNo, lineDesc = "1"});
- if (rmScale.Succeed && rmScale.Data.Count == 1 && list[0].weightTypeNo == "001033001")
- {
- // 重量类型为期限皮重
- if (list[0].weightTypeNo == "001033003")
- {
- // 判断这个车是否有留存期限皮重的权限
- MeterBaseTermTareCarService meterBaseTermTareCarService = new MeterBaseTermTareCarService();
- RESTfulResult<List<MeterBaseTermTareCar>> tareCarResult = meterBaseTermTareCarService.doQueryWf(new MeterBaseTermTareCar { carNo = PbCache.lockCarNo, valueFlag = "0" });
- if (tareCarResult.Succeed)
- {
- // 没有期限皮重权限
- if (tareCarResult.Data == null || tareCarResult.Data.Count == 0)
- {
- rt = saveMethod.doError("该车辆没有期限皮重权限,请联系计量大厅");
- PbCache.monitorResultMessage = "该车辆没有期限皮重权限";
- return rt;
- }
- // 有期限皮重权限
- else if (tareCarResult.Data.Count >= 1)
- {
- // 正常保存期限皮重
- rt = saveMethod.doTermTareData();
- }
- }
- }
- // 重量类型为普通毛重/皮重
- else if (list[0].weightTypeNo == "001033001" || list[0].weightTypeNo == "001033002")
- {
- // 查询一次计量数据表
- RESTfulResult<List<MeterWorkCarActualFirst>> rmFirst = mwcfs.doQueryByFlag(new MeterWorkCarActualFirst { carNo = PbCache.lockCarNo });
- if (rmX.Succeed)
- {
- List<MeterWorkCarActualFirst> firstList = rmFirst.Data;
- // 不存在有效的一次计量数据
- if (firstList == null || firstList.Count == 0)
- {
- // 历史皮重验证
- rt = saveMethod.validHisTare(list[0].weightTypeNo);
- // 重量类型为皮重且在皮重误差内
- if (list[0].weightTypeNo == "001033002" && (PbCache.monitorResult.valid_wgt == true || listMonitor.Data[0].validWgt == "0"))
- {
- /*sds
- * a. 正常保存重量匹配委托
- * b. 提示称重完成
- */
- mwaf.weightType = "1";
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- PbCache.voiceType = 1;
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- }
- // 重量类型为皮重且在皮重误差外
- else if (list[0].weightTypeNo == "001033002" && PbCache.monitorResult.valid_wgt == false && listMonitor.Data[0].validWgt == "1")
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
- }
- PbCache.voiceType = 13;
- rt = saveMethod.doError(PbCache.ResultMessage);
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- return rt;
- }
- // 重量类型为毛重,在皮重误差内
- else if (list[0].weightTypeNo == "001033001" && PbCache.monitorResult.valid_wgt == true && listMonitor.Data[0].validWgt == "1")
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为毛重,在皮重误差内";
- }
- PbCache.voiceType = 23;
- rt = saveMethod.doError(PbCache.ResultMessage);
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- return rt;
- }
- // 重量类型为毛重,不在皮重误差内
- else if (list[0].weightTypeNo == "001033001" && (PbCache.monitorResult.valid_wgt == false || listMonitor.Data[0].validWgt == "0"))
- {
- //判断称点是否允许期限皮重
- if (PbCache.sportInfo.allowedTareWeight == "1")
- {
- if (AppConfigCache.TareControlType == "3")
- {
- // 判断是否具有期限皮重权限
- MeterBaseUnitInfoService meterBaseUnitInfoService = new MeterBaseUnitInfoService();
- MeterBaseUnitInfo meterBaseUnitInfo = new MeterBaseUnitInfo();
- meterBaseUnitInfo.matterNo = rmScale.Data[0].matterNo;
- meterBaseUnitInfo.matterName = rmScale.Data[0].matterName;
- meterBaseUnitInfo.forwardingUnitNo = rmScale.Data[0].forwardingUnitNo;
- meterBaseUnitInfo.forwardingUnitName = rmScale.Data[0].forwardingUnitName;
- meterBaseUnitInfo.receivingUnitNo = rmScale.Data[0].receivingUintNo;
- meterBaseUnitInfo.receivingUnitName = rmScale.Data[0].receivingUintName;
- meterBaseUnitInfo.carNo = PbCache.lockCarNo;
- 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);
- PbCache.voiceType = 1;
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- }
- else
- {
- MeterBaseTermTareDataService meterBaseTermTareDataService = new MeterBaseTermTareDataService();
- RESTfulResult<MeterBaseTermTareData> termTareData = meterBaseTermTareDataService.doQueryPageWf(new MeterBaseTermTareData { carNo = PbCache.lockCarNo, valueFlag = "0",spotAreaNo = PbCache.sportInfo.spotAreaNo });
- if (termTareData.Succeed)
- {
- if (termTareData.Data == null)
- {
- mwaf.weightType = "0";
- // 只保存一次计量数据
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- PbCache.voiceType = 15;
- rt.resultInfo = "计量成功,期限皮过期,请留存期限皮";
- PbCache.ResultMessage = "计量成功,期限皮过期,请留存期限皮";
- PbCache.monitorResultMessage = "计量成功,期限皮过期,请留存期限皮";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,计量完成,期限皮过期", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- }
- 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);
- rt.resultInfo += ",期限皮结净";
- PbCache.voiceType = 16;
- PbCache.ResultMessage = "计量完成,期限皮结净";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,净重{2}吨,期限皮结净", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(PbCache.lockWgt - termTareData.Data.meterWeight.Value) / 1000), 2));
- }
- }
- }
- }
- }
- }
- else
- {
- mwaf.weightType = "0";
- // 只保存一次计量数据
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- PbCache.voiceType = 1;
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- }
- }
- else
- {
- rt = saveMethod.doError("程序处理异常");
- return rt;
- }
- }
- // 只存在一条有效的一次计量数据
- else if (firstList == null || firstList.Count == 1)
- {
- /*
- // 读结净最小值配置
- ComBaseInfoService cbis = new ComBaseInfoService();
- RESTfulResult<List<ComBaseInfo>> res = cbis.doQueryBaseList(new ComBaseInfo { baseCode = "001031001" });
- if (res.Succeed)
- {
- if (res.Data != null && res.Data.Count == 1)
- {
- try
- {
- diffrentWgt = Double.Parse(res.Data[0].baseName);
- }
- finally
- {
- }
- }
- }
- //*/
- if (firstList[0].weightType == "0" && list[0].weightTypeNo == "001033001")
- {
- // 历史皮重验证
- rt = saveMethod.validHisTare2(list[0].weightTypeNo);
- if (PbCache.monitorResult.valid_wgt == false || listMonitor.Data[0].validWgt == "0")
- {
- //判断称点是否允许期限皮重
- if (PbCache.sportInfo.allowedTareWeight == "1")
- {
- if (AppConfigCache.TareControlType == "3")
- {
- // 判断收发货单位是否具有期限皮重权限
- MeterBaseUnitInfoService meterBaseUnitInfoService = new MeterBaseUnitInfoService();
- MeterBaseUnitInfo meterBaseUnitInfo = new MeterBaseUnitInfo();
- meterBaseUnitInfo.matterNo = rmScale.Data[0].matterNo;
- meterBaseUnitInfo.matterName = rmScale.Data[0].matterName;
- meterBaseUnitInfo.forwardingUnitNo = rmScale.Data[0].forwardingUnitNo;
- meterBaseUnitInfo.forwardingUnitName = rmScale.Data[0].forwardingUnitName;
- meterBaseUnitInfo.receivingUnitNo = rmScale.Data[0].receivingUintNo;
- meterBaseUnitInfo.receivingUnitName = rmScale.Data[0].receivingUintName;
- meterBaseUnitInfo.carNo = PbCache.lockCarNo;
- 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);
- rt.resultInfo = "存在未结净毛重";
- PbCache.voiceType = 11;
- PbCache.ResultMessage = "存在未结净毛重";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,存在未结净毛重,请联系", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.monitorResultMessage = "存在未结净毛重";
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- }
- else
- {
- MeterBaseTermTareDataService meterBaseTermTareDataService = new MeterBaseTermTareDataService();
- RESTfulResult<MeterBaseTermTareData> termTareData = meterBaseTermTareDataService.doQueryPageWf(new MeterBaseTermTareData { carNo = PbCache.lockCarNo, valueFlag = "0" , spotAreaNo = PbCache.sportInfo.spotAreaNo });
- if (termTareData.Succeed)
- {
- if (termTareData.Data == null)
- {
- mwaf.weightType = "0";
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- rt.resultInfo = "期限皮过期,存在未结净毛重";
- PbCache.voiceType = 17;
- PbCache.ResultMessage = "期限皮过期,存在未结净毛重";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,期限皮过期,存在未结净毛重", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.monitorResultMessage = "期限皮过期,存在未结净毛重";
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- }
- 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";
- PbCache.voiceType = 16;
- PbCache.ResultMessage = "计量完成,期限皮结净";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,净重{2}吨,期限皮结净", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(PbCache.lockWgt - termTareData.Data.meterWeight.Value) / 1000), 2));
- rt = saveMethod.doNetTermTare(rmScale.Data[0], mwaf);
- rt.resultInfo += ",期限皮结净";
- }
- }
- }
- }
- }
- }
- else
- {
- mwaf.weightType = "0";
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- rt.resultInfo = "存在未结净毛重";
- PbCache.voiceType = 11;
- PbCache.ResultMessage = "存在未结净毛重";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,存在未结净毛重,请联系", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.monitorResultMessage = "存在未结净毛重";
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- }
- return rt;
- }
- else
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为毛重,在皮重误差内";
- }
- PbCache.voiceType = 23;
- rt = saveMethod.doError(PbCache.ResultMessage);
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- return rt;
- }
- }
- // 当次重量和上次重量满足结净最小值条件
- if (Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) > diffrentWgt || listMonitor.Data[0].validPredictionDiff == "0")
- {
- // 历史皮重验证
- rt = saveMethod.validHisTare(list[0].weightTypeNo);
- // 重量类型为皮重且在皮重误差内,正常结净
- if (list[0].weightTypeNo == "001033002" && (PbCache.monitorResult.valid_wgt == true || listMonitor.Data[0].validWgt == "0"))
- {
- // 正常结净
- //给一次数据匹配委托
- EntityBase<PreTrackScale> entityBase1 = new EntityBase<PreTrackScale>();
- mwaf = entityBase1.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
- mwaf.isPreScale = "1";
- rt = saveMethod.doNet(rmScale.Data[0], firstList[0], mwaf);
- PbCache.voiceType = 13;
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,净重{2}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- }
- // 重量类型为皮重且不在皮重误差内
- else if (list[0].weightTypeNo == "001033002" && PbCache.monitorResult.valid_wgt == false && listMonitor.Data[0].validWgt == "1")
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
- }
- PbCache.voiceType = 13;
- rt = saveMethod.doError(PbCache.ResultMessage);
- return rt;
- }
- // 重量类型为毛重,不在皮重误差内,正常结净
- else if (list[0].weightTypeNo == "001033001" && (PbCache.monitorResult.valid_wgt == false || listMonitor.Data[0].validWgt == "0"))
- {
- if (firstList[0].weightType == "0")
- {
- //判断称点是否允许期限皮重
- if (PbCache.sportInfo.allowedTareWeight == "1")
- {
- if (AppConfigCache.TareControlType == "3")
- {
- /// 判断是否具有期限皮重权限
- MeterBaseUnitInfoService meterBaseUnitInfoService = new MeterBaseUnitInfoService();
- MeterBaseUnitInfo meterBaseUnitInfo = new MeterBaseUnitInfo();
- meterBaseUnitInfo.matterNo = rmScale.Data[0].matterNo;
- meterBaseUnitInfo.matterName = rmScale.Data[0].matterName;
- meterBaseUnitInfo.forwardingUnitNo = rmScale.Data[0].forwardingUnitNo;
- meterBaseUnitInfo.forwardingUnitName = rmScale.Data[0].forwardingUnitName;
- meterBaseUnitInfo.receivingUnitNo = rmScale.Data[0].receivingUintNo;
- meterBaseUnitInfo.receivingUnitName = rmScale.Data[0].receivingUintName;
- meterBaseUnitInfo.carNo = PbCache.lockCarNo;
- 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);
- rt.resultInfo = "存在未结净毛重";
- PbCache.voiceType = 11;
- PbCache.ResultMessage = "存在未结净毛重";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,存在未结净毛重,请联系", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.monitorResultMessage = "存在未结净毛重";
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- }
- else
- {
- MeterBaseTermTareDataService meterBaseTermTareDataService = new MeterBaseTermTareDataService();
- RESTfulResult<MeterBaseTermTareData> termTareData = meterBaseTermTareDataService.doQueryPageWf(new MeterBaseTermTareData { carNo = PbCache.lockCarNo, valueFlag = "0", spotAreaNo = PbCache.sportInfo.spotAreaNo });
- if (termTareData.Succeed)
- {
- if (termTareData.Data == null)
- {
- mwaf.weightType = "0";
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- rt.resultInfo = "期限皮过期,存在未结净毛重";
- PbCache.voiceType = 17;
- PbCache.ResultMessage = "期限皮过期,存在未结净毛重";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,期限皮过期,存在未结净毛重", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.monitorResultMessage = "期限皮过期,存在未结净毛重";
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- }
- 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";
- PbCache.voiceType = 16;
- PbCache.ResultMessage = "计量完成,期限皮结净";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,净重{2}吨,期限皮结净", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(PbCache.lockWgt - termTareData.Data.meterWeight.Value) / 1000), 2));
- rt = saveMethod.doNetTermTare(rmScale.Data[0], mwaf);
- rt.resultInfo += ",期限皮结净";
- }
- }
- }
- }
- }
- }
- else
- {
- mwaf.weightType = "0";
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- rt.resultInfo = "存在未结净毛重";
- PbCache.voiceType = 11;
- PbCache.ResultMessage = "存在未结净毛重";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,存在未结净毛重,请联系", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.monitorResultMessage = "存在未结净毛重";
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- }
- }
- else
- {
- if (PbCache.sportInfo.allowedTareWeight == "1")
- {
- if (AppConfigCache.TareControlType == "3")
- {
- // 判断是否具有期限皮重权限
- MeterBaseUnitInfoService meterBaseUnitInfoService = new MeterBaseUnitInfoService();
- MeterBaseUnitInfo meterBaseUnitInfo = new MeterBaseUnitInfo();
- meterBaseUnitInfo.matterNo = rmScale.Data[0].matterNo;
- meterBaseUnitInfo.matterName = rmScale.Data[0].matterName;
- meterBaseUnitInfo.forwardingUnitNo = rmScale.Data[0].forwardingUnitNo;
- meterBaseUnitInfo.forwardingUnitName = rmScale.Data[0].forwardingUnitName;
- meterBaseUnitInfo.receivingUnitNo = rmScale.Data[0].receivingUintNo;
- meterBaseUnitInfo.receivingUnitName = rmScale.Data[0].receivingUintName;
- meterBaseUnitInfo.carNo = PbCache.lockCarNo;
- RESTfulResult<List<MeterBaseUnitInfo>> tareUnitResult = meterBaseUnitInfoService.doQueryWf(meterBaseUnitInfo);
- if (tareUnitResult.Succeed)
- {
- 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";
- PbCache.voiceType = 1;
- rt = saveMethod.doNet(rmScale.Data[0], firstList[0], mwaf);
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,净重{2}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- }
- else
- {
- MeterBaseTermTareDataService meterBaseTermTareDataService = new MeterBaseTermTareDataService();
- RESTfulResult<MeterBaseTermTareData> termTareData = meterBaseTermTareDataService.doQueryPageWf(new MeterBaseTermTareData { carNo = PbCache.lockCarNo, valueFlag = "0", spotAreaNo = PbCache.sportInfo.spotAreaNo });
- if (termTareData.Succeed)
- {
- // 正常结净
- //给一次数据匹配委托
- EntityBase<PreTrackScale> entityBase3 = new EntityBase<PreTrackScale>();
- mwaf = entityBase3.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
- mwaf.isPreScale = "1";
- mwaf.weightType = "0";
- PbCache.voiceType = 9;
- rt = saveMethod.doTermTareNet(rmScale.Data[0], mwaf, firstList[0],"0");
- rt.resultInfo += ",留存期限皮成功";
- PbCache.ResultMessage = "计量成功,留存期限皮成功";
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,净重{2}吨,留存期限皮成功", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(firstList[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- }
- }
- }
- }
- }
- else
- {
- // 正常结净
- //给一次数据匹配委托
- EntityBase<PreTrackScale> entityBase3 = new EntityBase<PreTrackScale>();
- mwaf = entityBase3.format<MeterWorkCarActualFirst>(rmScale.Data[0], mwaf);
- mwaf.isPreScale = "1";
- mwaf.weightType = "0";
- PbCache.voiceType = 1;
- rt = saveMethod.doNet(rmScale.Data[0], firstList[0], mwaf);
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,净重{2}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- }
- }
- }
- // 重量类型为毛重,在皮重误差内
- else if (list[0].weightTypeNo == "001033001" && PbCache.monitorResult.valid_wgt == true && listMonitor.Data[0].validWgt == "1")
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "毛重接近历史皮重,请联系处理";
- }
- PbCache.voiceType = 23;
- rt = saveMethod.doError(PbCache.ResultMessage);
- return rt;
- }
- }
- else
- {
- rt = saveMethod.doError("第一次计量重量【" + rmFirst.Data[0].meterWeight.Value / 1000 + "T】和第二次计量重量【" + PbCache.lockWgt / 1000 + "T】接近,小于结净最小值【" + diffrentWgt / 1000 + " T】");
- rt.isWarn = true;
- PbCache.voiceType = 4;
- PbCache.LEDResultMessage = "计量失败,小于结净最小值,请联系计量大厅";
- rt.WarnContent = "validWgt";
- return rt;
- }
- }
- // 存在多条有效的一次计量数据
- else if (firstList == null || firstList.Count > 1)
- {
- // 历史皮重验证
- rt = saveMethod.validHisTare(list[0].weightTypeNo);
- /* a. 程序报警a
- * b. 自动进行语音求助
- */
- //多条一次记录下判断是否全为毛重,是全部结净
- if (firstList[firstList.Count - 1].weightType == "0" && list[0].weightTypeNo == "001033002")
- {
- if (PbCache.monitorResult.valid_wgt == true || listMonitor.Data[0].validWgt == "0")
- {
- mwaf.weightType = "1";
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- PbCache.voiceType = 1;
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- }
- else
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
- }
- PbCache.voiceType = 13;
- rt = saveMethod.doError(PbCache.ResultMessage);
- return rt;
- }
-
- }
- else if (firstList[firstList.Count - 1].weightType == "0" && list[0].weightTypeNo == "001033001")
- {
- if (PbCache.monitorResult.valid_wgt == false || listMonitor.Data[0].validWgt == "0")
- {
- mwaf.weightType = "0";
- rt = saveMethod.doAddFirst(rmScale.Data[0], mwaf);
- PbCache.voiceType = 11;
- rt.resultInfo = string.Format("存在未结净毛重", firstList.Count);
- PbCache.ResultMessage = string.Format("存在未结净毛重", firstList.Count);
- PbCache.LEDResultMessage = string.Format("车号{0},毛重{1}吨,存在未结净毛重,请联系", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), firstList.Count);
- PbCache.monitorResultMessage = string.Format("存在未结净毛重", firstList.Count);
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- }
- else
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "毛重接近历史皮重,请联系处理";
- }
- PbCache.voiceType = 23;
- rt = saveMethod.doError(PbCache.ResultMessage);
- return rt;
- }
- }
- else
- {
- rt = saveMethod.doError("存在多条有效的一次计量数据,请联系计量大厅");
- PbCache.voiceType = 8;
- PbCache.LEDResultMessage = "存在多条有效的一次计量数据,请联系计量大厅";
- return rt;
- }
- }
- else
- {
- rt = saveMethod.doError("存在多条有效的一次计量数据,请联系计量大厅");
- PbCache.voiceType = 8;
- PbCache.LEDResultMessage = "存在多条有效的一次计量数据,请联系计量大厅";
- return rt;
- }
- }
- }
- }
- else
- {
- if (rmScale.Succeed && rmScale.Data.Count == 0)
- {
- // 查询一次计量数据表
- RESTfulResult<List<MeterWorkCarActualFirst>> rmFirst = mwcfs.doQueryByFlag(new MeterWorkCarActualFirst { carNo = PbCache.lockCarNo });
- if (rmFirst.Succeed)
- {
- List<MeterWorkCarActualFirst> firstList = rmFirst.Data;
- // 重量类型为皮重
- if (list[0].weightTypeNo == "001033002")
- {
- //if (PbCache.lockWgt > 25000)
- //{
- // rt = saveMethod.doError(string.Format("当前重量:{0},请确认是否,误选为皮重上秤", PbCache.lockWgt));
- // PbCache.voiceType = 26;
- // PbCache.LEDResultMessage = string.Format("当前重量:{0},请确认是否,误选为皮重上秤", PbCache.lockWgt);
- // return rt;
- //}
- // 历史皮重验证
- rt = saveMethod.validHisTare(list[0].weightTypeNo);
- if (firstList == null || firstList.Count == 0)
- {
- //在皮重误差内
- if (PbCache.monitorResult.valid_wgt == true || listMonitor.Data[0].validWgt == "0")
- {
- //正常保存一次数据
- mwaf.weightType = "1";
- PbCache.voiceType = 1;
- rt = saveMethod.doAddFirst(null, mwaf);
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- }
- else
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
- }
- rt = saveMethod.doError(PbCache.ResultMessage);
- PbCache.voiceType = 13;
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- return rt;
- }
- }
- else if (firstList.Count == 1 && firstList[0].weightType != "0")
- {
- // 在皮重误差内
- if (PbCache.monitorResult.valid_wgt == true || listMonitor.Data[0].validWgt == "0")
- {
- //保存一条作废的皮重数据
- mwaf.weightType = "1";
- mwaf.valueFlag = "0";
- PbCache.voiceType = 1;
- rt = saveMethod.doAddFirst(null, mwaf);
- PbCache.monitorResultMessage = string.Format("车号{0},连续保存皮重", PbCache.lockCarNo);
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- }
- else
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
- }
- rt = saveMethod.doError(PbCache.ResultMessage);
- rt.isWarn = true;
- PbCache.voiceType = 13;
- rt.WarnContent = "validWgt";
- return rt;
- }
- }
- else if (firstList.Count == 1 && firstList[0].weightType == "0")
- {
- RESTfulResult<List<PreTrackScale>> scales = preTrackScaleService.findCarScale(new PreTrackScale { predictionNo = firstList[0].predictionNo });
- if (PbCache.monitorResult.valid_wgt == true || listMonitor.Data[0].validWgt == "0")
- {
- if (scales.Data != null && scales.Data.Count > 0)
- {
- //判断称点是否允许期限皮重
- if (PbCache.sportInfo.allowedTareWeight == "1")
- {
- if (AppConfigCache.TareControlType == "3")
- {
- /// 判断是否具有期限皮重权限
- MeterBaseUnitInfoService meterBaseUnitInfoService = new MeterBaseUnitInfoService();
- MeterBaseUnitInfo meterBaseUnitInfo = new MeterBaseUnitInfo();
- meterBaseUnitInfo.matterNo = scales.Data[0].matterNo;
- meterBaseUnitInfo.matterName = scales.Data[0].matterName;
- meterBaseUnitInfo.forwardingUnitNo = scales.Data[0].forwardingUnitNo;
- meterBaseUnitInfo.forwardingUnitName = scales.Data[0].forwardingUnitName;
- meterBaseUnitInfo.receivingUnitNo = scales.Data[0].receivingUintNo;
- meterBaseUnitInfo.receivingUnitName = scales.Data[0].receivingUintName;
- meterBaseUnitInfo.carNo = PbCache.lockCarNo;
- RESTfulResult<List<MeterBaseUnitInfo>> tareUnitResult = meterBaseUnitInfoService.doQueryWf(meterBaseUnitInfo);
- if (tareUnitResult.Succeed)
- {
- if (tareUnitResult.Data == null || tareUnitResult.Data.Count == 0)
- {
- //匹配结净
- EntityBase<PreTrackScale> entityBase2 = new EntityBase<PreTrackScale>();
- mwaf = entityBase2.format<MeterWorkCarActualFirst>(scales.Data[0], mwaf);
- mwaf.isPreScale = "1";
- mwaf.weightType = "0";
- PbCache.voiceType = 1;
- rt = saveMethod.doNet(scales.Data[0], firstList[0], mwaf);
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,净重{2}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- }
- else
- {
- MeterBaseTermTareDataService meterBaseTermTareDataService = new MeterBaseTermTareDataService();
- RESTfulResult<MeterBaseTermTareData> termTareData = meterBaseTermTareDataService.doQueryPageWf(new MeterBaseTermTareData { carNo = PbCache.lockCarNo, valueFlag = "0", spotAreaNo = PbCache.sportInfo.spotAreaNo });
- if (termTareData.Succeed)
- {
- // 正常结净
- //给一次数据匹配委托
- EntityBase<PreTrackScale> entityBase3 = new EntityBase<PreTrackScale>();
- mwaf = entityBase3.format<MeterWorkCarActualFirst>(scales.Data[0], mwaf);
- mwaf.isPreScale = "1";
- mwaf.weightType = "1";
- PbCache.voiceType = 9;
- rt = saveMethod.doTermTareNet(scales.Data[0], firstList[0], mwaf, "1");
- rt.resultInfo += ",留存期限皮成功";
- PbCache.ResultMessage = "计量成功,留存期限皮成功";
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,净重{2}吨,留存期限皮成功", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(firstList[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- }
- }
- }
- }
- }
- else
- {
- //匹配结净
- EntityBase<PreTrackScale> entityBase2 = new EntityBase<PreTrackScale>();
- mwaf = entityBase2.format<MeterWorkCarActualFirst>(scales.Data[0], mwaf);
- mwaf.isPreScale = "1";
- mwaf.weightType = "0";
- PbCache.voiceType = 1;
- rt = saveMethod.doNet(scales.Data[0], firstList[0], mwaf);
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,净重{2}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- }
- }
- else
- {
- mwaf.weightType = "0";
- PbCache.voiceType = 1;
- rt = saveMethod.doNet(null, firstList[0], mwaf);
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,净重{2}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(rmFirst.Data[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- }
- }
- else
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
- }
- PbCache.voiceType = 13;
- rt = saveMethod.doError(PbCache.ResultMessage);
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- return rt;
- }
- }
- // 存在多条有效的一次计量数据
- else if (firstList.Count > 1)
- {
- //mwaf.weightType = "1";
- //rt = saveMethod.doAddFirst(null, mwaf);
- //PbCache.LEDResultMessage = string.Format("车号{0},重量{1}吨,之前存在多个未结净的毛重,请联系", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- //rt.resultInfo = "之前存在多个未结净的毛重";
- //PbCache.ResultMessage = "之前存在多个未结净的毛重";
- //PbCache.monitorResultMessage = "之前存在多个未结净的毛重";
- rt = saveMethod.validHisTare(list[0].weightTypeNo);
- if (PbCache.monitorResult.valid_wgt == true || listMonitor.Data[0].validWgt == "0")
- {
- int countTerm = 0;
- List<MeterWorkCarActualFirst> meterWorkCarActualFirsts = new List<MeterWorkCarActualFirst>();
- foreach (var item in firstList)
- {
- RESTfulResult<List<PreTrackScale>> scales = preTrackScaleService.findCarScale(new PreTrackScale { predictionNo = item.predictionNo });
- if (scales.Data == null || scales.Data.Count == 0)
- {
- countTerm++;
- }
- else
- {
- if (PbCache.sportInfo.allowedTareWeight == "1")
- {
- if (AppConfigCache.TareControlType == "3")
- {
- /// 判断是否具有期限皮重权限
- MeterBaseUnitInfoService meterBaseUnitInfoService = new MeterBaseUnitInfoService();
- MeterBaseUnitInfo meterBaseUnitInfo = new MeterBaseUnitInfo();
- meterBaseUnitInfo.matterNo = scales.Data[0].matterNo;
- meterBaseUnitInfo.matterName = scales.Data[0].matterName;
- meterBaseUnitInfo.forwardingUnitNo = scales.Data[0].forwardingUnitNo;
- meterBaseUnitInfo.forwardingUnitName = scales.Data[0].forwardingUnitName;
- meterBaseUnitInfo.receivingUnitNo = scales.Data[0].receivingUintNo;
- meterBaseUnitInfo.receivingUnitName = scales.Data[0].receivingUintName;
- meterBaseUnitInfo.carNo = PbCache.lockCarNo;
- RESTfulResult<List<MeterBaseUnitInfo>> tareUnitResult = meterBaseUnitInfoService.doQueryWf(meterBaseUnitInfo);
- if (tareUnitResult.Succeed)
- {
- if (tareUnitResult.Data == null || tareUnitResult.Data.Count == 0)
- {
- countTerm++;
- }
- else
- {
- MeterBaseTermTareDataService meterBaseTermTareDataService = new MeterBaseTermTareDataService();
- RESTfulResult<MeterBaseTermTareData> termTareData = meterBaseTermTareDataService.doQueryPageWf(new MeterBaseTermTareData { carNo = PbCache.lockCarNo, valueFlag = "0", spotAreaNo = PbCache.sportInfo.spotAreaNo });
- if (termTareData.Succeed)
- {
- meterWorkCarActualFirsts.Add(item);
- }
- }
- }
- }
- }
- else
- {
- countTerm++;
- }
- }
- }
- if (countTerm == 0)
- {
- rt = saveMethod.doNetAddMuchGross(meterWorkCarActualFirsts,mwaf);
- rt.resultInfo = "计量完成,留存期限皮成功";
- PbCache.voiceType = 9;
- PbCache.ResultMessage = "计量成功,留存期限皮成功";
- PbCache.monitorResultMessage = string.Format("计量成功,留存期限皮成功");
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,计量完成", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- }
- else if (countTerm == firstList.Count)
- {
- RESTfulResult<List<PreTrackScale>> scaleFirst = preTrackScaleService.findCarScale(new PreTrackScale { predictionNo = firstList[0].predictionNo });
- if (scaleFirst.Data == null || scaleFirst.Data.Count == 0)
- {
- mwaf.weightType = "0";
- PbCache.voiceType = 1;
- rt = saveMethod.doNet(null, firstList[0], mwaf);
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,净重{2}吨,存在未结净毛重", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(firstList[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- PbCache.monitorResultMessage = string.Format("车号{0}有{1}条未结净的毛重;", PbCache.lockCarNo, firstList.Count - 1);
- }
- else
- {
- //匹配结净
- EntityBase<PreTrackScale> entityBase2 = new EntityBase<PreTrackScale>();
- mwaf = entityBase2.format<MeterWorkCarActualFirst>(scaleFirst.Data[0], mwaf);
- mwaf.isPreScale = "1";
- mwaf.weightType = "0";
- PbCache.voiceType = 1;
- rt = saveMethod.doNet(scaleFirst.Data[0], firstList[0], mwaf);
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,净重{2}吨,存在未结净毛重", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2), Math.Round((Math.Abs(firstList[0].meterWeight.Value - PbCache.lockWgt) / 1000), 2));
- PbCache.monitorResultMessage = string.Format("车号{0}有{1}条未结净的毛重;", PbCache.lockCarNo, firstList.Count - 1);
- }
- }
- else
- {
- rt = saveMethod.doNetAddMuchGross(meterWorkCarActualFirsts, mwaf);
- PbCache.voiceType = 11;
- rt.resultInfo += ",存在未结净毛重";
- PbCache.ResultMessage = "计量成功,存在未结净毛重";
- PbCache.LEDResultMessage = string.Format("车号{0},皮重{1}吨,计量完成,存在未结净毛重", PbCache.lockCarNo, Math.Round((PbCache.lockWgt / 1000), 2));
- PbCache.monitorResultMessage = string.Format("车号{0}使用期限皮同时结净{1}条毛重数据,还有{2}条未结净的毛重;", PbCache.lockCarNo, firstList.Count - countTerm,countTerm);
- }
- }
- else
- {
- if (PbCache.ResultMessage == "")
- {
- PbCache.ResultMessage = "重量类型为皮重且不在皮重误差内";
- }
- PbCache.voiceType = 13;
- rt = saveMethod.doError(PbCache.ResultMessage);
- rt.isWarn = true;
- rt.WarnContent = "validWgt";
- return rt;
- }
- }
- }
- else
- {
- rt = saveMethod.doError("选择的委托不存在,请重新选择");
- PbCache.LEDResultMessage = "选择的委托不存在,请重新选择";
- PbCache.voiceType = 6;
- rt.isWarn = true;
- rt.WarnContent = "validIsPre";
- return rt;
- }
- }
- }
- else
- {
- rt = saveMethod.doError("存在多条已选择的委托,请联系计量大厅");
- PbCache.LEDResultMessage = "存在多条已选择的委托,请联系计量大厅";
- rt.isWarn = true;
- PbCache.voiceType = 19;
- rt.WarnContent = "validIsPre";
- return rt;
- }
- }
- }
- else
- {
- rt = saveMethod.doError("存在多条上称申请数据,请联系计量大厅");
- PbCache.voiceType = 20;
- PbCache.LEDResultMessage = "存在多条上称申请数据,请联系计量大厅";
- return rt;
- }
- }
- // 后台失败处理
- if (!rt.result)
- {
- rt.resultInfo = "称重数据保存失败";
- PbCache.voiceType = 25;
- PbCache.LEDResultMessage = "计量失败,请联系计量大厅";
- PbCache.monitorResultMessage = "";
- }
- return rt;
- }
- }
- }
|