256 lines
6.9 KiB
C#
256 lines
6.9 KiB
C#
|
|
/// <summary>
|
|
///INTERFACE CLASS FOR TABLE t_wmsFlow
|
|
///By wm
|
|
///on 06/04/2020
|
|
/// </summary>
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using DeiNiu.Utils;
|
|
|
|
namespace DeiNiu.wms.Data.Model
|
|
{
|
|
[Serializable]
|
|
public class WmsFlow : WmsFlow_base
|
|
{
|
|
private string taskNo;
|
|
|
|
public WmsFlow()
|
|
{
|
|
|
|
}
|
|
|
|
public WmsFlow(int id)
|
|
: base(id)
|
|
{
|
|
|
|
}
|
|
public WmsFlow(DataRow dr)
|
|
: base(dr)
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// 一个流水号对应一托货物
|
|
///
|
|
///
|
|
/// </summary>
|
|
/// <param name="flowNo"></param>
|
|
/* public WmsFlow(string flowNo)
|
|
{
|
|
cmdParameters[0] = flowNo;
|
|
getModel(200);
|
|
} */
|
|
|
|
public WmsFlow( string orderNo,string flowNo, enumFlowTaskStatus status ,EnumFlowTaskType type)
|
|
{
|
|
cmdParameters[0] = flowNo;
|
|
cmdParameters[1] = orderNo;
|
|
cmdParameters[2] =(int) status;
|
|
cmdParameters[3] = (int)type;
|
|
getModel(250);
|
|
}
|
|
public WmsFlow(string orderNo, string flowNo )
|
|
{
|
|
cmdParameters[0] = flowNo;
|
|
cmdParameters[1] = orderNo;
|
|
|
|
getModel(270);
|
|
}
|
|
|
|
public enumRepResult checkFlow(int ownerId,int taskType)
|
|
{
|
|
LogHelper.debug("checkFlow", string.Format(" flow task:{3} flow current owner: {0}, to valid ownerId: {1}, taskType: {2} ", owner, ownerId, taskType,task ));
|
|
if (owner>0 && owner != ownerId)
|
|
{
|
|
return enumRepResult.任务已被他人抢占;
|
|
}else if(owner == 0)
|
|
{
|
|
cmdParameters[0] = ownerId;
|
|
cmdParameters[1] = taskType;
|
|
int cnt = queryCount(280);
|
|
LogHelper.debug("checkFlow", string.Format(" flow current owner: {0}, to valid ownerId: {1}, taskType: {2}, exists cnt {3}", owner,ownerId,taskType,cnt));
|
|
if (cnt > WmsConstants.MAX_TASKS_OWN)
|
|
{
|
|
return enumRepResult.任务已达到上线;
|
|
}
|
|
}
|
|
|
|
return enumRepResult.成功;
|
|
|
|
}
|
|
|
|
public void finishedTasksPlus(int ownerId,decimal finishedPcs, bool isChildTasksOperation=false,bool isDone=false)
|
|
{
|
|
log.Debug( string.Format(" orderno {5}, ownerId {0}, finishedPcs: {1}, isChildTasksOperation: {2}, isDone {3}, state {4}",
|
|
ownerId, finishedPcs, isChildTasksOperation, isDone,state ,orderNo));
|
|
if (!isChildTasksOperation && state == (int)enumFlowTaskStatus.已完成)
|
|
{
|
|
return;
|
|
}
|
|
// if (finishedCnt < taskCnt)
|
|
{
|
|
finishedCnt++;
|
|
}
|
|
|
|
state = (int)enumFlowTaskStatus.进行中;
|
|
owner = ownerId;
|
|
if (isChildTasksOperation) //细分任务比总体任务多,更新原来任务数
|
|
{
|
|
if (taskCnt < finishedCnt)
|
|
{
|
|
taskCnt= finishedCnt;
|
|
}
|
|
|
|
|
|
if (isDone)
|
|
{
|
|
state = (int)enumFlowTaskStatus.已完成;
|
|
finishedCnt = taskCnt;
|
|
}
|
|
|
|
}else
|
|
if (finishedCnt >= taskCnt)
|
|
{
|
|
state = (int)enumFlowTaskStatus.已完成;
|
|
finishedCnt = taskCnt;
|
|
}
|
|
|
|
this.finishedPcs += finishedPcs> 0?finishedPcs:1;
|
|
|
|
Update();
|
|
}
|
|
|
|
|
|
public WmsFlow(string taskNo)
|
|
{
|
|
cmdParameters[0] = taskNo;
|
|
getModel(260);
|
|
}
|
|
|
|
protected override void getImp()
|
|
{
|
|
model_imp = new WmsFlow_Imp();
|
|
}
|
|
|
|
|
|
public DataTable getByFlowNo4Wince(string flowNo)
|
|
{
|
|
cmdParameters[0] = flowNo;
|
|
return CustQuery(300).Tables[0];
|
|
}
|
|
/*
|
|
public static bool isFlowFree(string flowNo)
|
|
{
|
|
return new WmsFlow(flowNo).ID == 0;
|
|
}
|
|
public static string flowOrderNo(string flowNo)
|
|
{
|
|
return new WmsFlow(flowNo).orderNo;
|
|
}
|
|
*/
|
|
public static bool free(string flowNo)
|
|
{
|
|
return false;
|
|
// return new WmsFlow().deleteFlow(flowNo) > 0;
|
|
// return new WmsFlow(flowNo).Delete()>0;
|
|
}
|
|
|
|
private int deleteFlow(string flowNo)
|
|
{
|
|
cmdParameters[0] = flowNo;
|
|
return CustOper(400);
|
|
}
|
|
|
|
public static void done(string flowNo)
|
|
{
|
|
//to update status of job, and progress on task.
|
|
// throw new NotImplementedException();
|
|
}
|
|
|
|
public DataTable getTasks(int status, int partion, int emId,int days=1)
|
|
{
|
|
cmdParameters[0] = status;
|
|
cmdParameters[1] = partion;
|
|
cmdParameters[2] = emId;
|
|
cmdParameters[3] = days;
|
|
return CustQuery(500).Tables[0];
|
|
}
|
|
|
|
public DataTable getTaskDetail(string taskNo)
|
|
{
|
|
cmdParameters[0] = taskNo;
|
|
return CustQuery(600).Tables[0];
|
|
}
|
|
|
|
public DataTable getFlowDetail(string flowNo)
|
|
{
|
|
cmdParameters[0] = flowNo;
|
|
return CustQuery(700).Tables[0];
|
|
}
|
|
public DataTable getTaskInfo(string taskNo)
|
|
{
|
|
cmdParameters[0] = flowNo;
|
|
return CustQuery(800).Tables[0];
|
|
}
|
|
|
|
/* public int startTask(string taskNo, int operId)
|
|
{
|
|
|
|
cmdParameters[0] = taskNo;
|
|
cmdParameters[1] = operId;
|
|
return CustOper(900) ;
|
|
}*/
|
|
public int startTask(string orderNo, string flowNo)
|
|
{
|
|
|
|
cmdParameters[0] = orderNo;
|
|
cmdParameters[1] = flowNo;
|
|
return CustOper(1000);
|
|
}
|
|
|
|
public DataTable getTaskDetail4Wince(string taskNo)
|
|
{
|
|
cmdParameters[0] = taskNo;
|
|
return CustQuery(601).Tables[0];
|
|
}
|
|
|
|
public Boolean isStarted(string orderNo,string flowNo)
|
|
{
|
|
cmdParameters[0] = orderNo;
|
|
cmdParameters[1] = flowNo;
|
|
return CustQuery(1100).Tables[0].Rows.Count>0;
|
|
}
|
|
|
|
public int startAllTask(string orderNo )
|
|
{
|
|
|
|
cmdParameters[0] = orderNo;
|
|
return CustOper(1200);
|
|
}
|
|
|
|
public DataTable getTodayTaskSum()
|
|
{
|
|
return CustQuery(1300).Tables[0];
|
|
}
|
|
|
|
public DataSet getTodayKanban()
|
|
{
|
|
return CustQuery(1600);
|
|
}
|
|
|
|
public DataTable getUnFinishedByOrderNo(string orderNo, EnumFlowTaskType taskType)
|
|
{
|
|
cmdParameters[0] = orderNo;
|
|
cmdParameters[1] = (int)taskType;
|
|
// cmdParameters[2] = flowNo;
|
|
|
|
return CustQuery(1700).Tables[0];
|
|
}
|
|
}
|
|
}
|
|
|