ldj/Model/wms/tables/WmsFlow.cs

254 lines
6.7 KiB
C#
Raw Normal View History

2023-05-23 16:13:17 +08:00

/// <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;
2023-11-21 19:18:23 +08:00
using DeiNiu.Utils;
2023-05-23 16:13:17 +08:00
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>
2023-11-21 19:18:23 +08:00
/* public WmsFlow(string flowNo)
{
cmdParameters[0] = flowNo;
getModel(200);
} */
2024-02-06 19:36:47 +08:00
public WmsFlow( string orderNo,string flowNo, enumFlowTaskStatus status ,EnumFlowTaskType type)
2023-05-23 16:13:17 +08:00
{
cmdParameters[0] = flowNo;
cmdParameters[1] = orderNo;
2023-11-21 19:18:23 +08:00
cmdParameters[2] =(int) status;
2024-02-06 19:36:47 +08:00
cmdParameters[3] = (int)type;
2023-05-23 16:13:17 +08:00
getModel(250);
}
2023-11-21 19:18:23 +08:00
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.;
}
2024-02-06 19:36:47 +08:00
public void finishedTasksPlus(int ownerId,decimal finishedPcs, bool isChildTasksOperation=false,bool isDone=false)
2023-11-21 19:18:23 +08:00
{
2024-02-06 19:36:47 +08:00
if (!isChildTasksOperation && state == (int)enumFlowTaskStatus.)
{
return;
}
// if (finishedCnt < taskCnt)
2023-11-21 19:18:23 +08:00
{
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;
}
2024-02-06 19:36:47 +08:00
this.finishedPcs += finishedPcs> 0?finishedPcs:1;
2023-11-21 19:18:23 +08:00
Update();
}
2023-05-23 16:13:17 +08:00
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];
}
2023-09-04 22:41:19 +08:00
/* public int startTask(string taskNo, int operId)
2023-05-23 16:13:17 +08:00
{
cmdParameters[0] = taskNo;
cmdParameters[1] = operId;
return CustOper(900) ;
2023-09-04 22:41:19 +08:00
}*/
public int startTask(string orderNo, string flowNo)
{
cmdParameters[0] = orderNo;
cmdParameters[1] = flowNo;
return CustOper(1000);
2023-05-23 16:13:17 +08:00
}
public DataTable getTaskDetail4Wince(string taskNo)
{
cmdParameters[0] = taskNo;
return CustQuery(601).Tables[0];
}
2023-09-04 22:41:19 +08:00
2023-11-21 19:18:23 +08:00
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()
2023-09-04 22:41:19 +08:00
{
2023-11-21 19:18:23 +08:00
return CustQuery(1600);
2023-09-04 22:41:19 +08:00
}
2024-02-06 19:36:47 +08:00
public DataTable getUnFinishedByOrderNo(string orderNo, EnumFlowTaskType taskType)
{
cmdParameters[0] = orderNo;
cmdParameters[1] = (int)taskType;
// cmdParameters[2] = flowNo;
return CustQuery(1700).Tables[0];
}
2023-05-23 16:13:17 +08:00
}
}