123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- using DBHelper;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using WCS.Core;
- using WCS.Entity;
- using WCS.Entity.Protocol;
- namespace WCS.Service.Works.Stations
- {
- [WorkTitle(typeof(ProductHandler), "抓取位")]
- public class 抓取位 : DeviceWork<Device<IStation521, IStation520>>
- {
- protected override bool SelectDevice(WCS_DEVICE obj)
- {
- return obj.CODE == "2153";
- }
- protected override void Do(Device<IStation521, IStation520> dev)
- {
- if (Ltc.Do(dev, v => v.Data2.CONFIRM == true))
- return;
- if (Ltc.Do(dev, v => v.Data.TASKNUM == 0))
- return;
- if (Ltc.Do(dev, v => v.Data.GOODSEND != 2153))
- return;
- if (Ltc.Do(dev, v => v.Data.PH_STATUS == false))
- throw new Exception("有任务但无光电信号");
- var taskid = dev.Data.TASKNUM;
- DB.Do(db =>
- {
- var task = db.Default.Set<WCS_TASK>().Find(taskid);
- if (task == null)
- throw new Exception("任务号" + taskid + "不存在");
- if (task.PRODLINE < 1 || task.PRODLINE > 9)
- throw new Exception("任务号" + taskid + "产线编号错误");
- //task.ADDRCURRENT = dev.Entity.CODE;
- db.Default.SaveChanges();
- dev.Data2.TASKNUM = taskid;
- dev.Data2.GOODSTYPE = task.PALLETTYPE;
- dev.Data2.GOODSSIZE = task.FULLQTY;
- dev.Data2.GOODSEND = task.PRODLINE;
- dev.Data2.GOODSCODE = task.DOCID;
- dev.Data2.CONFIRM = true;
- });
- }
-
- }
- }
|