using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.ServiceModel; using System.Text; using System.Data; using DeiNiu.wms.Logical; using DeiNiu.Utils; using DeiNiu.wms.Data.Model; namespace DeiNiu.Wcf { // 注意: 使用“重构”菜单上的“重命名”命令,可以同时更改代码、svc 和配置文件中的类名“WmsOutPickRequest”。 public class WmsOutPickRequestService : basicService, IWmsOutPickRequest { private static lWmsOutPickRequest _lop; lWmsOutPickRequest lop { get { if (_lop == null || _lop.operId != getOperId()) { _lop = new lWmsOutPickRequest(getOperId()); } return _lop; } } private static lWmsOutPickPort _lopp; lWmsOutPickPort lopp { get { if (_lopp == null || _lopp.operId != getOperId()) { _lopp = new lWmsOutPickPort(getOperId()); } return _lopp; } } private static lWmsWave _lww; lWmsWave lww { get { if (_lww == null || _lww.operId != getOperId()) { _lww = new lWmsWave(getOperId()); } return _lww; } } private static lWmsOutDesk _ldesk; lWmsOutDesk ldesk { get { if (_ldesk == null || _ldesk.operId != getOperId()) { _ldesk = new lWmsOutDesk(getOperId()); } return _ldesk; } } static bool isProcessWaveing = false; public void newPickWave() { if (isProcessWaveing) { LogHelper.debug(typeof(WmsOutPickRequestService), "!!!!!!!!!!!!!!!!! new pick wave ... is processing... return ...."); return; } isProcessWaveing = true; // WmsConstants.WAVE_LINE = line; // WmsConstants.WAVE_SALE = sales; try { // lopp.newBulkDPSPickWave(); lop.newBulkDPSandSeedsPickWave(); isProcessWaveing = false; } catch(Exception e) { LogHelper.debug(typeof(WmsOutPickRequestService), "!!!!!!!!!!!!!!!!!Exception !!!!!" +e.Message); LogHelper.debug(typeof(WmsOutPickRequestService),e.StackTrace ); throw e; } finally { isProcessWaveing = false; } } public void newSeedsWave() { if (isProcessWaveing) { LogHelper.debug(typeof(WmsOutPickRequestService), "!!!!!!!!!!!!!!!!! new pick wave ... is processing... return ...."); return; } isProcessWaveing = true; // WmsConstants.WAVE_LINE = line; // WmsConstants.WAVE_SALE = sales; try { // lopp.newBulkDPSPickWave(); lop.newBulkSeedsDPSPickWave(); isProcessWaveing = false; } catch (Exception e) { throw e; } finally { isProcessWaveing = false; } } public List newPartPickWave() { try { return lop.newPartPickWave(); } catch (Exception e) { throw e; } finally { } } static bool isProcessBatchWaveing = false; public void createPDAPickTasks(enumOutStoreType pickOrderType) { LogHelper.debug(typeof(WmsOutPickRequestService), "begin ---to create pick out pda task data"); if (isProcessBatchWaveing) { LogHelper.debug(typeof(WmsOutPickRequestService), "!!!!!!!!!!!!!!!!! create pick out pda data ... is processing... return ...."); } isProcessBatchWaveing = true; // WmsConstants.WAVE_LINE = line; // WmsConstants.WAVE_SALE = sales; try { isProcessBatchWaveing = false; lop.createPDAPickTasks(); LogHelper.debug(typeof(WmsOutPickRequestService), "end ---to create pick out pda task data"); } catch (Exception e) { log.Error(e); } finally { isProcessBatchWaveing = false; } } public void finishCurrentWave(string waveNo,bool isForce) { lop.finishCurrentWave(waveNo,isForce); } public void finishPartWave(int partion, bool isForce) { lop.finishPartWave(partion, isForce); } // public bool completeBulkValidation(string pickOrderNo, int bulkBox, int bulkBag, DataTable validationDetails) // { // return lop.completeBulkValidation(pickOrderNo, bulkBox, bulkBag, validationDetails); // } public bool completeBulkValidation(string pickOrderNo, int bulkBox, int bulkBag) { return lop.completeBulkValidation(pickOrderNo, bulkBox, bulkBag); } public bool completeSeedsPack(string pickOrderNo, int bulkBox=0,int bulkBag=0) { return lop.completeSeedsPack(pickOrderNo, bulkBox, bulkBag); } public bool completeBatchOut(string pickOrderNo) { return lop.updateBatchPickStatus(pickOrderNo,enumOutStockPickStatus.分拣完成); } public bool startBatchPick(string pickOrder) { return lop.startPickBatchPickOrder(pickOrder); } public DataSet Query(string querystr, int rownumStart, int rownumEnd) { return lop.Query(querystr, rownumStart, rownumEnd); } public DataTable getBulkDetailInCurrentWave() { return lop.getWmsOutPickRequest.getBulkDetailInCurrentWave().Tables[0]; } public DataTable getPartionBulkDetailInCurrentWave() { return lop.getWmsOutPickRequest.getPartionBulkDetailInCurrentWave() ; } public DataTable getPickDetailByWaveOrder(string waveOrder) { return lop.getWmsOutPickRequest.getPickDetailByWaveOrder(waveOrder).Tables[0]; } public DataTable getBulkValidationException(int status) { return lop.getWmsOutPickRequest.getBulkValidationException((enumOutStockPickStatus)status ).Tables[0]; } public DataSet getBatchOutPickOrders4Pick() { return lop.getBatchOutPickOrders4Pick() ; } public DataTable getBatchOutPickOrderDetails(string pickOrderNo) { return lop.getBatchOutPickOrderDetails(pickOrderNo).Tables[0]; } public DataTable getBatchOutPickOrderPickDetails(string pickOrderNo) { return lop.getBatchOutPickOrderPickDetails(pickOrderNo).Tables[0]; } public DataTable getPickDetails(string orderNo,bool isPickOrder) { return lop.getPickDetails(orderNo, isPickOrder).Tables[0]; } public DataSet getPickOrderDetails(string orderNo) { return lop.getPickDetails(orderNo, true ); } public DataTable getOrderLogs(string orderNo, bool isSaleOrder) { return lop.getOrderLogs(orderNo, isSaleOrder ); } public DataSet getPickRequest4BulkValidate(int desk) { return lop.getPickRequest4BulkValidate(desk) ; } public DataSet getPickRequest4SeedsOperation(int desk, int seedsStatus, string seedsNo = "") { enumOutStockRequestStatus status = (enumOutStockRequestStatus)seedsStatus; return lop.getPickRequest4SeedsOperation(desk, status, seedsNo); } public DataTable getPickDetailByPickOrderNo(string pickOrder) { return lop.getWmsOutPickRequest.getPickDetailByPickOrderNo(pickOrder).Tables[0]; } public DataTable getPickDetailBySeedsPickOrderNo(string pickOrder,int skuId) { return lop.getWmsOutPickRequest.getPickDetailBySeedsPickOrderNo(pickOrder,skuId).Tables[0]; } public DataTable getBulkValidationExceptionSolutions(int desk) { return lop.getWmsOutPickRequest.getBulkValidationExceptionSolutions(desk).Tables[0]; } public DataTable getOutRequestDetail(string pickOrder) { return lop.getWmsOutPickRequest.getOutRequestDetail(pickOrder).Tables[0]; } public DataTable getPickedData(int status) { return new WmsOutPickLable().getPickedData((enumPickState)status).Tables[0]; } public DataTable getPartPickedData(int status) { return new WmsOutPickLable().getPartPickedData((enumPickState)status).Tables[0]; } public DataTable getCurrentPickList(int status ) { return new WmsOutPickLable().getCurrentPickList((enumPickState)status).Tables[0]; } public DataTable getDpsPickList(string dpsOrder, int status) { return new WmsOutPickLable().getDpsPickList(dpsOrder,(enumPickState)status) ; } public DataTable getPartsPickList(int[] parts,int status) { return new WmsOutPickLable().getPartsPickList( parts,(enumPickState)status) ; } /// /// 取指定分区的,指定状态的亮灯数据 /// 按复核台、波次号 asc 排序 /// /// /// /// public DataTable getSeedDesksPickList(int part, int status) { return lop.getSeedDesksPickList(part, (enumPickState)status); } public DataTable getRequests( int orderStatus) { return lop.getWmsOutPickRequest.getRequests( (enumOutStockRequestStatus)orderStatus).Tables[0]; } public int getRequests4WaveCnt( int orderStatus) { return lop.getWmsOutPickRequest.getRequests( (enumOutStockRequestStatus)orderStatus).Tables[0].Rows.Count; } public bool updatePickingStatus(int color, int labId, int address, decimal count) { return lop.updatePickingStatus(color, labId, count, address); } public bool updatePortPickingStatus(int userId,int color, int labId, int address, decimal count) { return lop.updatePortPickingStatus(color, labId, count, address,userId); } public bool updateSeedsPickingStatus(int color, int labId, int address, decimal count,int partion=-1) { return lop.updateSeedsPickingStatus(color, labId, count, address); } public bool updateValidBulkPickStatus(int id, int status, string remark, int reason, decimal count,int checkedBy1) { return lop.finishBulkValidateItem( id, status, remark, reason, count, checkedBy1); } /// /// exception feedback /// /// /// /// /// /// public bool updateValidBulkPickExceptionStatus(int id, int status, string solution, int reason) { WmsOutPickDetail_tmp tmp = new WmsOutPickDetail_tmp(id); tmp.bulkPickState = status; tmp.solutionRemark = solution; tmp.validSolution = reason; tmp.operater = getOperId(); return tmp.Update() > 0; } public bool updatePriority(string[] orders, int priority) { return lop.updatePriority(orders, priority, getOperId()); } public void lightLables() { lop.lightLables(); } /** * seeds */ public DataTable getSeedsGoods(string seedsNo) { return lop.getSeedsGoods(seedsNo); } public DataSet getSeedsLightData(string seedsPickNo, string goodsId, string batch) { return new WmsOutPickRequest().getSeedsLightData(seedsPickNo, goodsId, batch) ; } public int updateSeedingStatus(string seedsPickNo, string goodsId, string batch, int labId, int address, decimal count,int checkedBy2) { LogHelper.debug(typeof(WmsOutPickRequestService), "begin to update seeding pick.....>"); return (int) lop.updateSeedingStatus(seedsPickNo, goodsId, batch, labId, address, count, checkedBy2); } public DataTable getSeedsPackingData(int desk) { return lop.outPickTmp.getPackingData(desk); } public DataTable getPackingDataByPickOrderNo(string pickOrderNo ) { return lop.outPickTmp.getPackingDataByPickOrderNo(pickOrderNo); } public DataTable getPickOrderTmsInfo(string pickOrderNo) { return lop.getPickOrderTmsInfo(pickOrderNo); } /// /// 取wave 拣货明细,打印取货标签 /// /// /// public DataTable getPickVolInfo(string waveNo, int volType) { return lopp.getPickInfo(waveNo, volType); } public DataTable getPickInfo(string waveNo ) { return lopp.getPickInfo(waveNo ); } public DataTable getPickSummary(string waveNo,int volType) { return lopp.getPickSummary(waveNo, volType); } public DataTable getPickLightTasks(int takeBy,int partion ,int orderType ) { return lopp.getPickLightTasks( takeBy, partion, orderType); } public int clearJobLightTask(string jobNo) { return lopp.clearJobLightTask(jobNo); } public bool regBox(string boxid, string waveno, int color) { return lop.regBox(boxid, waveno, color); } public DataSet getBoxRegWaves() { return lop.getBoxWaves(); } public DataTable getBoxsByWave(string waveOrder, int color = -1) { return lop.getBoxsByWave(waveOrder, color); } public string getWaveNoByBoxId(string boxId) { return lop.getWaveNoByBoxId(boxId); } public DataTable getWaveDeskByBoxId(string boxId) { return lop.getWaveDeskByBoxId(boxId); } public DataTable getPartionPickDetailByBoxId(String boxId) { return lop.getPartionPickDetailByBoxId(boxId); } public void switchLights(bool isOn) { WmsConstants.OUT_LIGHT_ENABLE = isOn; } public DataTable getBoxsByPickOrder(string pickOrderNo) { return lop.getBoxsByPickOrder(pickOrderNo); } public List getPartsFinishIds() { return lop.getPartsFinishIds(); } public void newPartionPick(string pickOrderNo, int partion) { lop.newPartionPick(pickOrderNo, partion); } public DataTable getOrderPickList(string orderNo, bool isPickOrder, int partion) { return lop.getOrderPickList(orderNo, isPickOrder, partion); } public DataSet getWaves(string query, int rowStart, int rowEnd) { return lww.Query(query, rowStart, rowEnd); } public DataSet getTasks(string query, int rowStart, int rowEnd) { return lopp.Query(query, rowStart, rowEnd); } public DataTable getRepTasks(int takeBy, int taskPartion) { return lopp.getRepTasks( takeBy, taskPartion ); } public DataSet getWaveDetailPages(string waveNo, int rowStart, int rowEnd) { return lopp.getWaveDetails(waveNo, rowStart, rowEnd); } public DataTable getWaveDetails(string waveNo) { return lopp.getWaveDetails(waveNo ); } static bool isCreateWaveing = false; public bool createPickWaves() { log.Debug(" svc begin to createPickWaves..."); bool ok = false; if (isCreateWaveing) { log.Debug("!!!!!!!!!!!!!!!!! new pick wave ... is processing... return ...."); return false; } isCreateWaveing = true; // WmsConstants.WAVE_LINE = line; // WmsConstants.WAVE_SALE = sales; try { ok = lopp.createPickWaves(); log.Debug("svc end createPickWaves..."); isCreateWaveing = false; } catch (Exception e) { log.Error(e); } finally { isCreateWaveing = false; } return ok; } public int regSeedsPlate(string plateId, int partion) { return (int)lop.regSeedsPlate(plateId, partion); } public DataTable getPlatePickList(string plateId, int partion) { return lop.getPlatePickList(plateId, partion); } public DataTable getDeskList(int deskType) { return lop.getDeskList((enumDeskType)deskType); } public int setDeskFree(int deskId) { return lop.setDeskFree(deskId); } public int setPlateFree(string plateId) { return lop.setPlateFree(plateId); } public DataTable getTaskAssigned(int operId, int partion, int lineId, bool batchOnly, int orderType) { return lopp.getAssignedTasks4Wince(operId, partion, lineId, batchOnly, (enumOrderType)orderType); } public DataTable getDeskByColor(int color) { return new WmsOutDesk().getDeskByColor(color); } public int setDeskAvailable(int color, bool isAvailable) { return ldesk.setAvailable(color, isAvailable); } public DataTable lightByJob(int userId,string jobNo,bool isValid) { return lopp.prePareLightByJob(userId,jobNo,isValid); } public DataTable getRequestDtByTransNo(string transNo) { return lop.getRequestDtByTransNo(transNo); } public string assignTasks(int[] ids, int empId) { return lop.assignTasks(ids, empId); } public DataTable getLightTasks(string query,int wareHouse,int partion, int lineId,int state,string date,bool isLight) { return lopp.getLightTasks(query,wareHouse, partion, lineId, state,date,isLight); } public DataTable lightSeeds(int deskId, string flowno, string barcode, int userId, bool isValid) { return lopp.prePareLightSeeds(deskId, flowno, barcode, userId, isValid); } } }