|
@@ -1040,6 +1040,59 @@ class WorkOrder extends Api
|
|
|
$this->success('成功',$data);
|
|
$this->success('成功',$data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 打印作业通知单->工单印件和工序获取
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function PrintCodeList()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $list = \db('工单_印件资料')
|
|
|
|
|
+ ->field([
|
|
|
|
|
+ 'rtrim(yj_Yjno)' => '印件号',
|
|
|
|
|
+ 'rtrim(yj_yjmc)' => '印件名称'
|
|
|
|
|
+ ])
|
|
|
|
|
+ ->where('Yj_Gdbh',$param['workOrder'])
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 打印作业通知单->工艺编号获取
|
|
|
|
|
+ * @ApiMethod (GET)
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ */
|
|
|
|
|
+ public function ProcessCodeList()
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->request->isGet() === false){
|
|
|
|
|
+ $this->error('请求错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $param = $this->request->param();
|
|
|
|
|
+ if (empty($param)){
|
|
|
|
|
+ $this->error('参数错误');
|
|
|
|
|
+ }
|
|
|
|
|
+ $list = \db('工单_工艺资料')
|
|
|
|
|
+ ->field('rtrim(Gy0_gxh) as 工序号')
|
|
|
|
|
+ ->where([
|
|
|
|
|
+ 'Gy0_gdbh' => $param['workOrder'],
|
|
|
|
|
+ 'Gy0_yjno' => $param['yjno']
|
|
|
|
|
+ ])
|
|
|
|
|
+ ->select();
|
|
|
|
|
+ $this->success('成功',$list);
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* 打印作业通知单
|
|
* 打印作业通知单
|
|
|
* @ApiMethod (POST)
|
|
* @ApiMethod (POST)
|
|
@@ -1058,7 +1111,7 @@ class WorkOrder extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
- $data = $this->workOrderDetailGet($param['workOrder']);
|
|
|
|
|
|
|
+ $data = $this->workOrderDetailGet($param['workOrder'],$param['yjno']);
|
|
|
if (empty($data)){
|
|
if (empty($data)){
|
|
|
$this->success('未找到工单信息');
|
|
$this->success('未找到工单信息');
|
|
|
}
|
|
}
|
|
@@ -1066,7 +1119,7 @@ class WorkOrder extends Api
|
|
|
if (empty($materiel)){
|
|
if (empty($materiel)){
|
|
|
$this->success('未找到物料信息');
|
|
$this->success('未找到物料信息');
|
|
|
}
|
|
}
|
|
|
- $printDetail = $this->PrintDetailGet($param['workOrder']);
|
|
|
|
|
|
|
+ $printDetail = $this->PrintDetailGet($param['workOrder'],$param['yjno'],$param['gxh']);
|
|
|
if (empty($printDetail)){
|
|
if (empty($printDetail)){
|
|
|
$this->success('未找到工艺信息');
|
|
$this->success('未找到工艺信息');
|
|
|
}
|
|
}
|
|
@@ -1088,9 +1141,10 @@ class WorkOrder extends Api
|
|
|
* @param $workOrder
|
|
* @param $workOrder
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
- public function workOrderDetailGet($workOrder)
|
|
|
|
|
|
|
+ public function workOrderDetailGet($workOrder,$yjno)
|
|
|
{
|
|
{
|
|
|
$sql = "SELECT
|
|
$sql = "SELECT
|
|
|
|
|
+ RTRIM( a.Gd_lx) AS 工单类型,
|
|
|
RTRIM( a.Gd_gdbh ) AS 生产批次号,
|
|
RTRIM( a.Gd_gdbh ) AS 生产批次号,
|
|
|
RTRIM( a.销售订单号 ) AS 销售订单号,
|
|
RTRIM( a.销售订单号 ) AS 销售订单号,
|
|
|
RTRIM( a.Gd_客户代号 ) AS 客户代号,
|
|
RTRIM( a.Gd_客户代号 ) AS 客户代号,
|
|
@@ -1121,7 +1175,7 @@ class WorkOrder extends Api
|
|
|
`工单_基本资料` AS a
|
|
`工单_基本资料` AS a
|
|
|
JOIN `工单_印件资料` AS b ON b.Yj_Gdbh = a.Gd_gdbh
|
|
JOIN `工单_印件资料` AS b ON b.Yj_Gdbh = a.Gd_gdbh
|
|
|
WHERE
|
|
WHERE
|
|
|
- a.Gd_gdbh = '{$workOrder}' AND a.行号 = 1";
|
|
|
|
|
|
|
+ a.Gd_gdbh = '{$workOrder}' AND a.行号 = 1 AND b.yj_Yjno = '{$yjno}'";
|
|
|
$list = Db::query($sql);
|
|
$list = Db::query($sql);
|
|
|
if (empty($list)){
|
|
if (empty($list)){
|
|
|
$this->success('未找到订单数据');
|
|
$this->success('未找到订单数据');
|
|
@@ -1169,10 +1223,12 @@ class WorkOrder extends Api
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
* @throws \think\exception\DbException
|
|
* @throws \think\exception\DbException
|
|
|
*/
|
|
*/
|
|
|
- public function PrintDetailGet($workOrder)
|
|
|
|
|
|
|
+ public function PrintDetailGet($workOrder,$yjno,$gxh)
|
|
|
{
|
|
{
|
|
|
$where = [
|
|
$where = [
|
|
|
'Gy0_gdbh' => $workOrder,
|
|
'Gy0_gdbh' => $workOrder,
|
|
|
|
|
+ 'Gy0_yjno' => $yjno,
|
|
|
|
|
+ 'Gy0_gxh' => ['<=',$gxh]
|
|
|
];
|
|
];
|
|
|
$filed = 'rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,
|
|
$filed = 'rtrim(Gy0_yjno) as yjno,rtrim(Gy0_gxh) as gxh,rtrim(Gy0_gxmc) as gxmc,rtrim(Add_gxmc) as add_gxmc,
|
|
|
rtrim(损耗系数) as 损耗系数,rtrim(Gy0_ls) as ls,rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_计划损耗) as 计划损耗,
|
|
rtrim(损耗系数) as 损耗系数,rtrim(Gy0_ls) as ls,rtrim(Gy0_计划接货数) as 计划接货数,rtrim(Gy0_计划损耗) as 计划损耗,
|
|
@@ -1233,7 +1289,18 @@ class WorkOrder extends Api
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- //新增工单
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 新增工单->添加工单
|
|
|
|
|
+ * @ApiMethod (POST)
|
|
|
|
|
+ * @param
|
|
|
|
|
+ * @return void
|
|
|
|
|
+ * @throws \think\Exception
|
|
|
|
|
+ * @throws \think\db\exception\BindParamException
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ * @throws \think\exception\DbException
|
|
|
|
|
+ * @throws \think\exception\PDOException
|
|
|
|
|
+ */
|
|
|
|
|
|
|
|
public function WorkOrderAdd()
|
|
public function WorkOrderAdd()
|
|
|
{
|
|
{
|
|
@@ -1244,7 +1311,97 @@ class WorkOrder extends Api
|
|
|
if (empty($param)){
|
|
if (empty($param)){
|
|
|
$this->error('参数错误');
|
|
$this->error('参数错误');
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ $num = \db('工单_基本资料')->where('Gd_gdbh',$param['gdbh'])->count();
|
|
|
|
|
+ $productDetail = \db('产品_基本资料')->where('产品编号',$param['cpdh'])->find();
|
|
|
|
|
+ $lastId = \db('工单_基本资料')->order('Uniqid desc')->value('Uniqid');
|
|
|
|
|
+ if ($lastId<1000000000){
|
|
|
|
|
+ $lastId = 1000000000;
|
|
|
|
|
+ }
|
|
|
|
|
+ $data = [
|
|
|
|
|
+ 'Gd_lx' =>$param['zdgd'],
|
|
|
|
|
+ 'Gd_生产分类' =>$param['sclx'],
|
|
|
|
|
+ '成本处理类别' =>'',
|
|
|
|
|
+ 'Gd_gdbh' =>$param['gdbh'],
|
|
|
|
|
+ '行号' =>$num+1 ,
|
|
|
|
|
+ 'Gd_客户代号' =>$param['khdh'],
|
|
|
|
|
+ 'Gd_客户名称' =>$param['khmc'],
|
|
|
|
|
+ 'Gd_khdh' =>$param['khdh'],
|
|
|
|
|
+ 'Gd_khmc' =>$param['khmc'],
|
|
|
|
|
+ '客户料号' =>rtrim($productDetail['客户料号']),
|
|
|
|
|
+ '客户ERP编码' =>$param['erp'],
|
|
|
|
|
+ 'Gd_cpdh' =>$param['cpdh'],
|
|
|
|
|
+ 'Gd_cpmc' =>$param['cpmc'],
|
|
|
|
|
+ '成品代号' =>$param['cpdh'],
|
|
|
|
|
+ '成品名称' =>$param['cpmc'],
|
|
|
|
|
+ '产品版本号' =>$param['bbh'],
|
|
|
|
|
+ '销售订单号' =>$param['xsddh'],
|
|
|
|
|
+ '警语版面' =>$param['jybm'],
|
|
|
|
|
+ '码源数量' =>$param['mysl'],
|
|
|
|
|
+ '排产时库存' =>$param['kcdx'],
|
|
|
|
|
+ '投料大箱' =>$param['tldx'],
|
|
|
|
|
+ '投料率' =>$param['tll'],
|
|
|
|
|
+ '平均合格率' =>$param['hgl'],
|
|
|
|
|
+ '进程备注' =>$param['jcbz'],
|
|
|
|
|
+ 'Gd_desc' =>$param['remark'],
|
|
|
|
|
+ '开单日期' =>date('Y-m-d H:i:s',time()),
|
|
|
|
|
+ '接单日期' =>$param['start'],
|
|
|
|
|
+ '交货日期' =>$param['end'],
|
|
|
|
|
+ '订单数量' =>$param['number'],
|
|
|
|
|
+ '计量单位' =>$param['tldw'],
|
|
|
|
|
+ '计划投料' =>$param['pztl'],
|
|
|
|
|
+ '实际投料' =>$param['wxz'],
|
|
|
|
|
+ '产品单价' =>0,
|
|
|
|
|
+ '入仓日期' =>'1900-01-01 00:00:00',
|
|
|
|
|
+ '工单入仓数量' =>0,
|
|
|
|
|
+ '工单制程废品' => 0,
|
|
|
|
|
+ '工单质检废品' => 0,
|
|
|
|
|
+ '工单无形损' => 0,
|
|
|
|
|
+ '工单计划损耗' => 0,
|
|
|
|
|
+ '工单完工日期' => $param['end'],
|
|
|
|
|
+ '投料确认' => '',
|
|
|
|
|
+ 'gd_statu' => '3-计划中',
|
|
|
|
|
+ '直接人工' => 0,
|
|
|
|
|
+ '分摊人工' => 0,
|
|
|
|
|
+ '直接材料' => 0,
|
|
|
|
|
+ '考核直接材料' => 0,
|
|
|
|
|
+ '分摊材料' => 0,
|
|
|
|
|
+ '考核分摊材料' => 0,
|
|
|
|
|
+ '直接折旧' => 0,
|
|
|
|
|
+ '水电气费' => 0,
|
|
|
|
|
+ '分摊空调' => 0,
|
|
|
|
|
+ '分摊锅炉' => 0,
|
|
|
|
|
+ '分摊废气处理' => 0,
|
|
|
|
|
+ '分摊空压机' => 0,
|
|
|
|
|
+ '分摊鼓风机' => 0,
|
|
|
|
|
+ '分摊其他' => 0,
|
|
|
|
|
+ '待摊人工' => 0,
|
|
|
|
|
+ '待摊折旧' => 0,
|
|
|
|
|
+ '待摊场地租金' => 0,
|
|
|
|
|
+ '待摊其他费用' => 0,
|
|
|
|
|
+ '加工费' => 0,
|
|
|
|
|
+ '加工费单价' => 0,
|
|
|
|
|
+ '成本考核_胶印' => 0,
|
|
|
|
|
+ '成本考核_凹印' => 0,
|
|
|
|
|
+ '成本考核_丝印' => 0,
|
|
|
|
|
+ '成本考核_模切' => 0,
|
|
|
|
|
+ '成本考核_检验' => 0,
|
|
|
|
|
+ '印版费' => 0,
|
|
|
|
|
+ 'V23制造成本' => 0,
|
|
|
|
|
+ 'Prt_rq' => date('Y-m-d H:i:s',time()),
|
|
|
|
|
+ 'Sys_id' => '',
|
|
|
|
|
+ 'Sys_rq' => date('Y-m-d H:i:s',time()),
|
|
|
|
|
+ 'Mod_rq' => date('Y-m-d H:i:s',time()),
|
|
|
|
|
+ 'U8UID' => '',
|
|
|
|
|
+ 'Uniqid' => $lastId+1,
|
|
|
|
|
+ '工序加工费' => 0,
|
|
|
|
|
+ ];
|
|
|
|
|
+ $sql= \db('工单_基本资料')->fetchSql(true)->insert($data);
|
|
|
|
|
+ $res = \db()->query($sql);
|
|
|
|
|
+ if ($res !== false){
|
|
|
|
|
+ $this->success('成功');
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $this->error('失败');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1306,4 +1463,19 @@ class WorkOrder extends Api
|
|
|
}
|
|
}
|
|
|
$this->success('成功',$list);
|
|
$this->success('成功',$list);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //新增印件资料->印件资料添加
|
|
|
|
|
+
|
|
|
|
|
+// public function PrintDetailAdd()
|
|
|
|
|
+// {
|
|
|
|
|
+// if (Request::instance()->isPost() === false){
|
|
|
|
|
+// $this->error('请求错误');
|
|
|
|
|
+// }
|
|
|
|
|
+// $param = Request::instance()->post();
|
|
|
|
|
+// if (empty($param)){
|
|
|
|
|
+// $this->error('参数错误');
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
}
|
|
}
|