|
|
@@ -46,9 +46,8 @@ class WorkOrderSpotCheck extends Api{
|
|
|
case '裁剪':
|
|
|
//订单编号
|
|
|
$ddh = explode('-', $order)[0];
|
|
|
- $currentDateTime = date("Y-m-d H:i:s");
|
|
|
|
|
|
- // 查询未出库的记录,若存在则进行批量出库和日志记录
|
|
|
+ //查询未出库的记录,若存在则进行批量出库和日志记录
|
|
|
$data = \db('工单_印件资料')
|
|
|
->where(['子订单编号' => $order, 'ck_rq' => null])
|
|
|
->find();
|
|
|
@@ -59,43 +58,27 @@ class WorkOrderSpotCheck extends Api{
|
|
|
->where('订单编号', $ddh)
|
|
|
->whereNull('出库日期')
|
|
|
->fetchSql(true)
|
|
|
- ->update(['出库日期' => $currentDateTime]);
|
|
|
+ ->update(['出库日期' => date("Y-m-d H:i:s")]);
|
|
|
\db()->query($sql);
|
|
|
|
|
|
- // 获取相同颜色备注的未出库子订单编号列表
|
|
|
- $sameColorList = \db('工单_印件资料')
|
|
|
- ->where(['订单编号' => $ddh, 'Mod_rq' => null, 'ck_rq' => null])
|
|
|
- ->field('子订单编号')
|
|
|
- ->select();
|
|
|
// 更新工单_印件资料表的出库日期
|
|
|
$sql = \db('工单_印件资料')
|
|
|
- ->where('订单编号', $ddh)
|
|
|
+ ->where('子订单编号', $order)
|
|
|
->whereNull('Mod_rq')
|
|
|
->whereNull('ck_rq')
|
|
|
->fetchSql(true)
|
|
|
- ->update(['ck_rq' => $currentDateTime]);
|
|
|
- $updateCount1 = \db()->query($sql);
|
|
|
-// if ($updateCount1 > 0) {
|
|
|
-// // 批量生成并插入日志数据
|
|
|
-// $logData = array_map(function ($item) use ($currentDateTime, $params) {
|
|
|
-// return [
|
|
|
-// 'order_id' => $item['子订单编号'],
|
|
|
-// 'rq' => $currentDateTime,
|
|
|
-// 'name' => $params['code'],
|
|
|
-// 'sys_id' => '裁剪自动出库'
|
|
|
-// ];
|
|
|
-// }, $sameColorList);
|
|
|
-// \db('设备_报工日志')->insertAll($logData);
|
|
|
-// } else {
|
|
|
-// return $this->error('网络异常,重新尝试');
|
|
|
-// }
|
|
|
+ ->update(['ck_rq' => date("Y-m-d H:i:s")]);
|
|
|
+ \db()->query($sql);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- //查询子订单编号对应数据【条码查询】
|
|
|
+
|
|
|
+ //查询子订单编号对应数据
|
|
|
if (strpos($order, '-') !== false) {
|
|
|
+ //判断 $order -后面是否是两位
|
|
|
if (preg_match('/-(\d{2})$/', $order, $matches)) {
|
|
|
$number = (int)$matches[1];
|
|
|
- //船样单子
|
|
|
+ //船样单子为:订单编号-90~99
|
|
|
if ($number > 70) {
|
|
|
$data = \db('工单_基本资料')->alias('j')
|
|
|
->distinct('y.子订单编号')
|
|
|
@@ -115,8 +98,7 @@ class WorkOrderSpotCheck extends Api{
|
|
|
->where('y.子订单编号', $order)
|
|
|
->select();
|
|
|
} else {
|
|
|
- //获取原始子订单编号【-01】
|
|
|
- $ddbh = explode('-', $order)[0];//获取订单编号
|
|
|
+ //获取原始子订单编号【-01】后期不需要else中代码可以删除掉
|
|
|
//【查询尺码、制单数、填写报工新增实裁数】
|
|
|
$data = \db('工单_基本资料')->alias('j')
|
|
|
->distinct('y.子订单编号')
|
|
|
@@ -133,11 +115,11 @@ class WorkOrderSpotCheck extends Api{
|
|
|
->where(function($query) {
|
|
|
$query->whereNull('y.Mod_rq')->whereOr('y.Mod_rq', '');
|
|
|
}) // 查询未删除数据
|
|
|
- ->where('y.子订单编号', 'like', '%' . $ddbh . '%')
|
|
|
+ ->where('y.子订单编号', 'like', '%' . $ddh . '%')
|
|
|
->select();
|
|
|
}
|
|
|
}else{
|
|
|
- $ddbh = explode('-', $order)[0];//获取订单编号
|
|
|
+// $ddbh = explode('-', $order)[0];//获取订单编号
|
|
|
//【查询尺码、制单数、填写报工新增实裁数】
|
|
|
$data = \db('工单_基本资料')->alias('j')
|
|
|
->distinct('y.子订单编号')
|
|
|
@@ -154,14 +136,10 @@ class WorkOrderSpotCheck extends Api{
|
|
|
->where(function($query) {
|
|
|
$query->whereNull('y.Mod_rq')->whereOr('y.Mod_rq', '');
|
|
|
}) // 查询未删除数据
|
|
|
- ->where('y.子订单编号', 'like', '%' . $ddbh . '%')
|
|
|
+ ->where('y.订单编号', 'like', '%' . $ddh . '%')
|
|
|
->select();
|
|
|
}
|
|
|
|
|
|
-// echo "<pre>";
|
|
|
-// print_r($data);
|
|
|
-// echo "<pre>";
|
|
|
-
|
|
|
$dataEntry = [];
|
|
|
$list = [];
|
|
|
$headers = [];//存放尺码表头
|
|
|
@@ -417,9 +395,7 @@ class WorkOrderSpotCheck extends Api{
|
|
|
'bgtable' => $existingRecords
|
|
|
];
|
|
|
}else {
|
|
|
-
|
|
|
-
|
|
|
- //【查询订单编号对应的数据】
|
|
|
+ //查询订单编号对应的数据
|
|
|
$data = \db('工单_基本资料')->alias('j')
|
|
|
->distinct('y.子订单编号')
|
|
|
->field('
|