|
|
@@ -78,7 +78,7 @@ class Product extends Backend
|
|
|
$str = explode(';',$bach);
|
|
|
$batch = $str[(count($str))-1];
|
|
|
$bach_info = Db::name('task')->where('bach',$batch)->find();
|
|
|
-// Cache::set('bach',serialize($bach_info),0);
|
|
|
+ Cache::set('bach',serialize($bach_info),0);
|
|
|
$form = Db::name('formula')->find($bach_info['fid']);
|
|
|
// $res = Db::name('formula_detail')->where('pid = '.$bach_info['fid'].' and version = "'.$form['version'].'"')->field('id,pid,material,version,is_replace,gy_name')->select();
|
|
|
$res = Db::name('formula_detail')->where('pid',$bach_info['fid'])->where('version',$form['version'])->field('id,pid,material,version,is_replace,gy_name')->select();
|
|
|
@@ -101,32 +101,32 @@ class Product extends Backend
|
|
|
public function get_formula(){
|
|
|
$bach = unserialize(Cache::get('bach'));//获取配方单信息
|
|
|
$formula = $this->request->post('formula');//配方名称
|
|
|
- $data = unserialize(Cache::get('data'));//获取当前批次号缓存数据
|
|
|
+// $data = unserialize(Cache::get('data'));//获取当前批次号缓存数据
|
|
|
$arr = [];
|
|
|
$arr['material']=$formula;
|
|
|
- foreach($data as $vv) {
|
|
|
- //没有替代料 error==0为有当前配方, error==1为没有配方,,前台提示
|
|
|
- if ($vv['is_replace'] == 0) {
|
|
|
- if ($vv['material'] == $formula) {
|
|
|
- $arr['error'] = 0;
|
|
|
- break;
|
|
|
- } else {
|
|
|
- $arr['error'] = 1;
|
|
|
- }
|
|
|
- } else {//有替代料
|
|
|
- foreach ($vv['replace'] as $val) {
|
|
|
- if ($val['material'] == $formula) {
|
|
|
- $arr['error'] = 0;
|
|
|
- break;
|
|
|
- } else {
|
|
|
- $arr['error'] = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- if ($arr['error'] == 0) {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+// foreach($data as $vv) {
|
|
|
+// //没有替代料 error==0为有当前配方, error==1为没有配方,,前台提示
|
|
|
+// if ($vv['is_replace'] == 0) {
|
|
|
+// if ($vv['material'] == $formula) {
|
|
|
+// $arr['error'] = 0;
|
|
|
+// break;
|
|
|
+// } else {
|
|
|
+// $arr['error'] = 1;
|
|
|
+// }
|
|
|
+// } else {//有替代料
|
|
|
+// foreach ($vv['replace'] as $val) {
|
|
|
+// if ($val['material'] == $formula) {
|
|
|
+// $arr['error'] = 0;
|
|
|
+// break;
|
|
|
+// } else {
|
|
|
+// $arr['error'] = 1;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if ($arr['error'] == 0) {
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
//查询数据库↓ 缓存↑
|
|
|
$form = Db::name('formula')->find($bach['fid']);
|
|
|
$res = Db::name('formula_detail')->where('pid = '.$bach['fid'].' and material like "%'.encrypt($formula).'%" and version = "'.$form['version'].'"')->select();
|
|
|
@@ -144,6 +144,7 @@ class Product extends Backend
|
|
|
$arr['error']=0;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
$arr['pname'] = $bach['name'];//配方名称
|
|
|
$arr['time'] = date("Y-m-d H:i:s");
|
|
|
$arr['bach'] = $bach['bach'];
|