TabUseBackService.java 23.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449
package cn.csbr.app.service;

import cn.csbr.app.config.FxConfigure;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.app.model.InboundItem;
import cn.csbr.app.model.RfidDataModel;
import cn.csbr.springboot.dao.mapper.HisGoodsMapper;
import cn.csbr.springboot.dao.mapper.MfcubestockdetailMapper;
import cn.csbr.springboot.dao.model.*;
import com.alibaba.fastjson.JSON;
import com.csbr.mybatis.CommonMapper;
import javafx.scene.control.TableColumn;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import tk.mybatis.mapper.entity.Example;

import java.sql.Timestamp;
import java.util.*;

@Service
public class TabUseBackService {
    private static Logger logger = LoggerFactory.getLogger(TabUseBackService.class);
    @Autowired
    private CommonMapper commonMapper;
    @Autowired
    private GUIContext guiContext;

    @Autowired
    private FxConfigure fxConfigure;
    @Autowired
    private MfcubestockdetailMapper mfcubestockdetailMapper;

    @Autowired
    private HisGoodsMapper hisGoodsMapper;
    @Value("${istkyccj}")
    private String yck;
    @Transactional
    public synchronized Map<String,List<InboundItem>> queryTabInboundItem(RfidDataModel rfidDataModel, String rfidData) {
        logger.info("入参为rfidDataModel:"+JSON.toJSONString(rfidDataModel)+"  rfidData"+rfidData );
        //设置操作人人是从柜子柜子对象中取得
        String cubeGuid = rfidDataModel.getCabinetCd();
        String operaterId = rfidDataModel.getUserCd();
        String operaterName = rfidDataModel.getUserName();
        if(operaterId==null||operaterId.isEmpty())
        {
            operaterId=guiContext.getLoginUser().getGuid();
            operaterName=guiContext.getLoginUser().getUserName();

        }
        List<InboundItem> yclist=new ArrayList<>();

        Map<String,List<InboundItem>> useBackMap = new HashMap<>();
        useBackMap.put("erorrlist",yclist);
        //将str转化list
        String str[] = rfidData.split(",");
        List<String> rfidList = Arrays.asList(str);
        if(yck.equals("1")){
//            private final TableColumn<InboundItem, String> userName = new TableColumn<>("操作人");//getOperaterName
//            private final TableColumn<InboundItem, String> goodsSpec = new TableColumn<>("规格型号");//getGoodsspec
//            private final TableColumn<InboundItem, String> usetime = new TableColumn<>("异常原因");//getUse_time
//            private final TableColumn<InboundItem, String> goods = new TableColumn<>("商品名");//getGoodsname
//            private final TableColumn<InboundItem, String> batchNo = new TableColumn<>("批号");//p.getValue().getBacthCode() + "\n" + df.format(p.getValue().getProductiondate()) + "\n" + df.format(p.getValue().getExpiredate());
//            private final TableColumn<InboundItem, String> barCode = new TableColumn<>("高值码/RFID");//getBarcode
//            private final TableColumn<InboundItem, String> allocation = new TableColumn<>("柜子");//getAllocation

            for(int i=0;i<rfidList.size();i++){
                String item=rfidList.get(i);
                if(item.equals("'1234'")){
                    System.out.println("1234已被排除");
                    continue;
                }
                String inboundSql = "select * FROM trchargingdetail where RfidUid="+item+"";
                System.out.println("异常处理SQL(判断是否是被消耗):"+inboundSql);
                List<Map> xhs = commonMapper.queryList(inboundSql);
                InboundItem inboundItem = new InboundItem();
                if(xhs!=null&&xhs.size()>0){
                    Trchargingdetail data = JSON.parseObject(JSON.toJSONString(xhs.get(0)), Trchargingdetail.class);
                    inboundItem.setOperaterName(operaterName);
                    inboundItem.setOperaterId(operaterId);
                    inboundItem.setGoodscode(data.getGoodsCode());
                    inboundItem.setGuid("已消耗的耗材");
                    inboundItem.setGoodsname(data.getGoodsname());
                    inboundItem.setBacthCode(data.getLot());
                    inboundItem.setExpiredate(data.getExpiredate());
                    inboundItem.setProductiondate(data.getProductiondate());
                    inboundItem.setBarcode(data.getBarcode());
                    inboundItem.setAllocation(cubeGuid);
                    yclist.add(inboundItem);
                    //rfidList.remove(i);
                    continue;
                }
                inboundSql = "select * from mfcubestockstatement where Type='6' and RfidUid="+item;
                System.out.println("异常处理SQL(判断是否是被退货):"+inboundSql);
                xhs = commonMapper.queryList(inboundSql);
                if(xhs!=null&&xhs.size()>0){
                    Mfcubestockstatement data = JSON.parseObject(JSON.toJSONString(xhs.get(0)), Mfcubestockstatement.class);
                    inboundItem.setOperaterName(operaterName);
                    inboundItem.setOperaterId(operaterId);
                    inboundItem.setGoodscode(data.getGoodscode());
                    inboundItem.setGuid("已退货的耗材");
                    inboundItem.setGoodsname(data.getGoodsname());
                    inboundItem.setBacthCode(data.getLot());
                    inboundItem.setExpiredate(data.getExpiredate());
                    inboundItem.setProductiondate(data.getProductiondate());
                    inboundItem.setBarcode(data.getBarcode());
                    inboundItem.setAllocation(cubeGuid);
                    yclist.add(inboundItem);
                   // rfidList.remove(i);
                    continue;
                }
                inboundSql = "select * from spd_wvdetail_scend where RfidUid="+item;
                System.out.println("异常处理SQL(非法RFID):"+inboundSql);
                xhs = commonMapper.queryList(inboundSql);
                if(xhs==null||xhs.size()==0){
                    inboundItem.setOperaterName(operaterName);
                    inboundItem.setOperaterId(operaterId);
                    inboundItem.setGoodscode("未知");
                    inboundItem.setGuid("未知的RFID:"+item);
                    inboundItem.setGoodsname("未知");
                    inboundItem.setBacthCode("未知");
                    inboundItem.setExpiredate(new Date());
                    inboundItem.setProductiondate(new Date());
                    inboundItem.setBarcode("未知");
                    inboundItem.setAllocation(cubeGuid);
                    //状态为Y(在柜子中)且未扫描到的耗材为取出的耗材
                    yclist.add(inboundItem);
                    //rfidList.remove(i);
                    continue;
                }
            }
        }
        logger.info("入库开始");
        //获取入库数据 2019/3/19
        String inboundSql = "SELECT A.GUID,d.model,A.BillNo,A.RowNo,A.GoodsGuid, CONCAT(A.GoodsSpec,d.model) GoodsCode,A.GoodsName,A.GoodsSpec,A.Unit,A.Price,A.RegistKey,A.Manufacturer,A.SupplierGUID,A.SupplierName,A.GoodsType,1 MVQty,A.PRICE * 1 Amount,A.Lot,A.ProductionDate,A.ExpireDate,A.SterilantLot,A.SterilantDate,A.SterilantEXPDate,A.Cargoposition,A.MvDate,A.Memo,A.OrgGUID,A.OrgName, b.rfiduid AS temprfiduid,b.barcode as barcode" +
                " from Spd_wvdetail a , " +
                " spd_wvdetail_scend b,"+
                " spd_wv c," +
                " his_goods d " +
                "where A.BILLNO=B.BILLNO  " +
                "AND a.guid = b.rdguid  " +
                "and a.rowno =b.RowNo " +
                "and a.BillNo = c.BillNo " +
                "and b.BillState = 'N' " +
                "and b.RfidUid in (" + rfidData + ") "+
                "and b.PrintState = 'Y'" +
                "and a.goodsguid=d.guid and exists (select 'x' from sys_store_org aa where aa.deptguid=c.meddeptguid and aa.storeguid="+"'"+guiContext.getStoreguid()+"'"+")";
        System.out.println("入库查询SQL:"+inboundSql);
        List<Map> inBoundmaps = commonMapper.queryList(inboundSql);

        List<InboundItem> inboundItems = new ArrayList<>();
        for (Map map : inBoundmaps) {

            SpdWvdetail data = JSON.parseObject(JSON.toJSONString(map), SpdWvdetail.class);

            InboundItem inboundItem = new InboundItem();
            inboundItem.setOperaterId(operaterId);
            inboundItem.setOperaterName(operaterName);
            inboundItem.setRowNo(data.getRowno());
            inboundItem.setScanQty(data.getMvqty().intValue());
            inboundItem.setSrcOrderCode(data.getBillno());
            inboundItem.setQty(data.getAmount().intValue());

            System.out.println(inBoundmaps.get(0).get("model"));
            System.out.println("goodcode:"+data.getGoodsspec());
            inboundItem.setGoodscode(data.getGoodscode());
            inboundItem.setGoodsname(data.getGoodsname());
            if(map.get("model")==null)
                map.put("model","");
            inboundItem.setGoodsspec(data.getGoodsspec()+map.get("model"));
            inboundItem.setUnit(data.getUnit());
            inboundItem.setIfScand((byte) 0);
            inboundItem.setSupplierName(data.getSuppliername());
            inboundItem.setSupplierGuid(data.getSupplierguid());
            inboundItem.setBacthCode(data.getLot());
            inboundItem.setSrcInboundDate(data.getMvdate());
            inboundItem.setTraceCode(data.getBarcode());
            inboundItem.setBarcode(data.getBarcode());
            inboundItem.setGuid(data.getGuid());
            inboundItem.setRegistkey(data.getRegistkey());
            inboundItem.setManufacturer(data.getManufacturer());
            inboundItem.setProductiondate(data.getProductiondate());
            inboundItem.setExpiredate(data.getExpiredate());
            inboundItem.setRfiduid(data.getTemprfiduid());
            //logger.info("------------------------ 扫描并核对入柜数据 ------------------------");
            //  logger.info("=====" + inboundItem.getRfiduid());
            if (rfidData.contains(data.getTemprfiduid())) {
                inboundItem.setIfInCabinet((byte) 1);
                inboundItem.setIfScand((byte) 1);
                for (Cabinet cabinet : guiContext.getCabinets()) {
                    if (cabinet.getCabinetcode().equals(cubeGuid)) {
                        inboundItem.setAllocation(cabinet.getCabinetcode());
                        inboundItem.setAllocationGuid(cabinet.getGuid());
                        break;
                    }
                }
            }
            inboundItems.add(inboundItem);
        }
        useBackMap.put("inboundList",inboundItems);

        //获取取货数据


        String sql = " select * from mfcubestockdetail ta where  Billstate='Y' and ta.CubeGuid in (select guid from  cabinet where groupcode='" + fxConfigure.getCabinetGroupCode() + "') and  rfiduid not  in (" + rfidData + ") and ta.cubename='" + cubeGuid+"'" +
                " AND storeguid='" + guiContext.getStoreguid()  + "'";
        logger.info(sql);
        List<Map> maps = commonMapper.queryList(sql);
        List<InboundItem> useItems = new ArrayList<>();
        List<InboundItem> backItems = new ArrayList<>();
        for (Map map : maps) {
            InboundItem inboundItem = new InboundItem();
            Mfcubestockdetail data = JSON.parseObject(JSON.toJSONString(map), Mfcubestockdetail.class);
            inboundItem.setScanQty(Double.valueOf(data.getNumber()).intValue());
            inboundItem.setSrcOrderCode(data.getRkBillNo());
            inboundItem.setQty(Double.valueOf(data.getNumber()).intValue());
            inboundItem.setGoodsguid(data.getGoodsGUID());
            inboundItem.setGoodsname(data.getGoodsName());
            inboundItem.setUnit(data.getUnit());
            inboundItem.setIfScand((byte) 0);
            inboundItem.setSupplierName(data.getSupplierName());
            inboundItem.setSupplierGuid(data.getSupplierGUID());
            inboundItem.setBacthCode(data.getLot());
            inboundItem.setTraceCode(data.getLabGuid());
            inboundItem.setBarcode(data.getLabGuid());
            inboundItem.setGuid(data.getGuid());
            Example example = new Example(HisGoods.class);

              HisGoods hisGoods = hisGoodsMapper.selectByPrimaryKey(data.getGoodsGUID());
              if(hisGoods!=null) {
                  if (hisGoods.getModel() != null) {
                      inboundItem.setGoodsspec(hisGoods.getGoodsspec() + hisGoods.getModel());
                  } else {
                      inboundItem.setGoodsspec(hisGoods.getGoodsspec());
                  }
              }


            inboundItem.setAllocation(data.getCubeName());
            inboundItem.setAllocationGuid(data.getCubeGuid());
            inboundItem.setIfInCabinet((byte) 1);
            inboundItem.setIfScand((byte) 1);
            inboundItem.setProductiondate(data.getProductiondate());
            inboundItem.setExpiredate(data.getExpireDate());
            inboundItem.setRfiduid(data.getRfidUid());
            inboundItem.setOperaterId(operaterId);
            inboundItem.setOperaterName(operaterName);
            //状态为Y(在柜子中)且未扫描到的耗材为取出的耗材
            useItems.add(inboundItem);

        }

        useBackMap.put("useList",useItems);
        logger.info("取货结束");
        String sqlmove = " select * from mfcubestockdetail ta where  Billstate='Y' AND CubeGuid in (select guid from  cabinet where groupcode='" + fxConfigure.getCabinetGroupCode() + "')  and Rfiduid in    (" + rfidData + ") and ta.cubename<>'" + cubeGuid+"'" +
              " AND storeguid='" + guiContext.getStoreguid()  + "'";
       // String sqlmove = " select * from mfcubestockdetail ta where  Billstate='Y' AND CubeGuid in (select guid from  cabinet where groupcode in (" + guiContext.getCommongroupcode()+ " ) )  and Rfiduid in    (" + rfidData + ") and ta.cubename<>'" + cubeGuid+"'" +
        //        " AND DepotGuid='" + guiContext.getLoginUser().getOrgGuid()  + "'";
        logger.info("移库开始");
        logger.info(sqlmove);
        List<Map> mapsmove = commonMapper.queryList(sqlmove);
        for(Map map : mapsmove)
        {
            InboundItem inboundItem = new InboundItem();
            Mfcubestockdetail data = JSON.parseObject(JSON.toJSONString(map), Mfcubestockdetail.class);
            inboundItem.setScanQty(Double.valueOf(data.getNumber()).intValue());
            inboundItem.setSrcOrderCode(data.getRkBillNo());
            inboundItem.setQty(Double.valueOf(data.getNumber()).intValue());
            inboundItem.setGoodsguid(data.getGoodsGUID());
            inboundItem.setGoodsname(data.getGoodsName());
            inboundItem.setUnit(data.getUnit());
            inboundItem.setIfScand((byte) 0);
            inboundItem.setSupplierName(data.getSupplierName());
            inboundItem.setSupplierGuid(data.getSupplierGUID());
            inboundItem.setBacthCode(data.getLot());
            inboundItem.setTraceCode(data.getLabGuid());
            inboundItem.setBarcode(data.getLabGuid());
            inboundItem.setGuid(data.getGuid());
            for (Cabinet cabinet : guiContext.getCabinets()) {
                if (cabinet.getCabinetcode().equals(cubeGuid)) {
                    logger.error("发生移柜操作"+"从"+data.getCubeName()+"到"+cubeGuid);
                    data.setLocGuid(cabinet.getGuid());
                    inboundItem.setAllocation(cabinet.getCabinetcode());
                    inboundItem.setAllocationGuid(cabinet.getGuid());
                    data.setLocName(cabinet.getCabinetcode());
                    data.setCubeName(cabinet.getCabinetcode());
                    data.setCubeGuid(cabinet.getGuid());
                    mfcubestockdetailMapper.updateByPrimaryKeySelective(data);
                    break;
                }
            }
        }
        logger.info("移库结束");

        String sqlback = " select * from  mfcubestockdetail ta where ta.CubeGuid in (select guid from  cabinet where groupcode='" + fxConfigure.getCabinetGroupCode() + "') and Billstate='O' and  rfiduid in (" + rfidData + ")" +
               " AND storeguid='" + guiContext.getStoreguid()  + "'";
       // String sqlback = " select * from  mfcubestockdetail ta where ta.CubeGuid in (select guid from  cabinet where groupcode in (" +  guiContext.getCommongroupcode() + " )) and Billstate='O' and  rfiduid in (" + rfidData + ")" +
        //        " AND DepotGuid='" + guiContext.getLoginUser().getOrgGuid()  + "'";

        logger.info("还货开始");
        logger.info(sqlback );
        List<Map> mapsback = commonMapper.queryList(sqlback);
        for (Map map:mapsback)
        {
            InboundItem inboundItem = new InboundItem();
            Mfcubestockdetail data = JSON.parseObject(JSON.toJSONString(map), Mfcubestockdetail.class);
            inboundItem.setScanQty(Double.valueOf(data.getNumber()).intValue());
            inboundItem.setSrcOrderCode(data.getRkBillNo());
            inboundItem.setQty(Double.valueOf(data.getNumber()).intValue());
            inboundItem.setGoodsguid(data.getGoodsGUID());
            inboundItem.setGoodsname(data.getGoodsName());
            inboundItem.setUnit(data.getUnit());
            inboundItem.setIfScand((byte) 0);
            inboundItem.setSupplierName(data.getSupplierName());
            inboundItem.setSupplierGuid(data.getSupplierGUID());
            inboundItem.setBacthCode(data.getLot());
            inboundItem.setTraceCode(data.getLabGuid());
            inboundItem.setBarcode(data.getLabGuid());
            inboundItem.setGuid(data.getGuid());
            Example example = new Example(HisGoods.class);
            HisGoods hisGoods = hisGoodsMapper.selectByPrimaryKey(data.getGoodsGUID());
           if(hisGoods!=null) {
               if (hisGoods.getModel() != null) {
                   inboundItem.setGoodsspec(hisGoods.getGoodsspec() + hisGoods.getModel());
               } else {
                   inboundItem.setGoodsspec(hisGoods.getGoodsspec());
               }
           }
            inboundItem.setAllocation(data.getCubeName());
            inboundItem.setAllocationGuid(data.getCubeGuid());
            inboundItem.setIfInCabinet((byte) 1);
            inboundItem.setIfScand((byte) 1);
            inboundItem.setProductiondate(data.getProductiondate());
            inboundItem.setExpiredate(data.getExpireDate());
            inboundItem.setRfiduid(data.getRfidUid());
            inboundItem.setOperaterId(operaterId);
            inboundItem.setOperaterName(operaterName);
            if (!data.getCubeName().equals(cubeGuid)) {
                for (Cabinet cabinet : guiContext.getCabinets()) {
                    if (cabinet.getCabinetcode().equals(cubeGuid)) {
                        data.setLocGuid(cabinet.getGuid());
                        inboundItem.setAllocation(cabinet.getCabinetcode());
                        inboundItem.setAllocationGuid(cabinet.getGuid());
                        data.setLocName(cabinet.getCabinetcode());
                        data.setCubeName(cabinet.getCabinetcode());
                        data.setCubeGuid(cabinet.getGuid());
                        mfcubestockdetailMapper.updateByPrimaryKeySelective(data);
                        break;
                    }
                }
            }
            //状态为Y(在柜子中)且未扫描到的耗材为取出的耗材
            backItems.add(inboundItem);
        }
        useBackMap.put("backList",backItems);
        logger.info("还货结束");
        return useBackMap;
    }


    //更新取还货确认状态为已确认
    @Transactional
    public synchronized void updateTabInboundItemIssure(List<InboundItem> inboundItems) {
        String barcodes="";
        for(InboundItem inboundItem:inboundItems) {
            barcodes += "'" + inboundItem.getBarcode() + "'" + ",";
        }
        if(StringUtils.isEmpty(barcodes)) {
            return;
        }
        String sql = "select t.* from " +
                "(select * from mfcubestockstatement where barcode in ("+barcodes.substring(0,barcodes.length()-1)+")" +
                " order by create_time desc limit 1000000000) t " +
                " group by t.barcode";
        List<Map> staments =  commonMapper.queryList(sql);
        if(CollectionUtils.isEmpty(staments)) {
            return;
        }
        String guids = "";
        for (Map map : staments) {
            Mfcubestockstatement mfcubestockstatement = JSON.parseObject(JSON.toJSONString(map), Mfcubestockstatement.class);
            guids += "'" + mfcubestockstatement.getGuid() + "'" + ",";
        }
        String updatesql = "update mfcubestockstatement  set isSure = '1',update_time='"+new Timestamp(new Date().getTime())+"' where guid in ("+guids.substring(0,guids.length()-1)+")";
        commonMapper.update(updatesql);

    }
    @Transactional
    public synchronized List<InboundItem> queryretruntime(String time) {

        // String cubeGuid = rfidDataModel.getCabinetCd();
        String sql="select *  FROM mfcubestockdetail WHERE BillState='O' and CubeGuid in (select guid from  cabinet where groupcode='"+fxConfigure.getCabinetGroupCode() +"')  AND storeguid='" + guiContext.getStoreguid()  + "' and use_time is not null and use_time<=DATE_SUB(NOW(), interval "+time+" hour)";
        // String sql = " select * from mfcubestockdetail ta where  Billstate='Y' and ta.CubeGuid in (select guid from  cabinet where groupcode='" + + "') and  rfiduid not  in (" + rfidData + ") and ta.cubename='" + cubeGuid+"'" +
        //        " AND DepotGuid=''";
        logger.info(sql);
        List<Map> maps = commonMapper.queryList(sql);
        List<InboundItem> useItems = new ArrayList<>();
        for (Map map : maps) {
            InboundItem inboundItem = new InboundItem();
            Mfcubestockdetail data = JSON.parseObject(JSON.toJSONString(map), Mfcubestockdetail.class);
            data.setUseTime((Date) map.get("use_time"));
            data.setUseUsername(map.get("use_username").toString());
            inboundItem.setScanQty(Double.valueOf(data.getNumber()).intValue());
            inboundItem.setSrcOrderCode(data.getRkBillNo());
            inboundItem.setQty(Double.valueOf(data.getNumber()).intValue());
            inboundItem.setGoodsguid(data.getGoodsGUID());
            inboundItem.setGoodsname(data.getGoodsName());
            inboundItem.setUnit(data.getUnit());
            inboundItem.setIfScand((byte) 0);
            inboundItem.setSupplierName(data.getSupplierName());
            inboundItem.setSupplierGuid(data.getSupplierGUID());
            inboundItem.setBacthCode(data.getLot());
            inboundItem.setTraceCode(data.getLabGuid());
            inboundItem.setBarcode(data.getLabGuid());
            inboundItem.setGuid(data.getGuid());
            inboundItem.setUse_time(data.getUseTime());
            Example example = new Example(HisGoods.class);

            HisGoods hisGoods = hisGoodsMapper.selectByPrimaryKey(data.getGoodsGUID());
            if(hisGoods.getModel()!=null) {
                inboundItem.setGoodsspec(hisGoods.getGoodsspec() + hisGoods.getModel());
            }else{
                inboundItem.setGoodsspec(hisGoods.getGoodsspec() );
            }


            inboundItem.setAllocation(data.getCubeName());
            inboundItem.setAllocationGuid(data.getCubeGuid());
            inboundItem.setIfInCabinet((byte) 1);
            inboundItem.setIfScand((byte) 1);
            inboundItem.setProductiondate(data.getProductiondate());
            inboundItem.setExpiredate(data.getExpireDate());
            inboundItem.setRfiduid(data.getRfidUid());
            //inboundItem.setOperaterId(data);
            inboundItem.setOperaterName(data.getUseUsername());
            inboundItem.setUse_time(data.getUseTime());
            //状态为Y(在柜子中)且未扫描到的耗材为取出的耗材
            useItems.add(inboundItem);

        }

        return useItems;
    }
}