| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070 |
- 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;
- }
- }
- }
|