推荐_库存管理多发物料自动结转到车间仓库脚本_使用经验
作者 |
|
chymore [个人空间]
注册  2011-05-22 发贴数 33 精华数 0 原创贴 1 来自 状态 正常
级别 会员 |
|
|
之前发料只能整箱发,导致每次都有多发物料,后面这些物料都堆积在车间,很是浪费,为解决这个问题,所有才有了这个脚本。 1、准备工作 a、启用表格自定义项,我这里是“vr_item_ext_1”,名称为配料数量 b、增加一个用来放车间多领物料的仓库,我这里代码是“31” 2、代码如下 int func_after_oper() { int id,r_num,shop_edt_num,request_num,input_num,shop_num,new_shop_num,new_shop_num_r; string sql,result,r_res_id,r_batch_no; //can_save=1; r_num = grid_row_num('MG_Item'); //msg(r_num); for(id=1;id<r_num;id++) { r_res_id=grid_get_v('MG_Item','res_id',id); r_batch_no=grid_get_v('MG_Item','batch_no',id); request_num=grid_get_v('MG_Item','vr_item_ext_1',id); sql="select * from edt_res where batch_no='"+r_batch_no+"' and res_id='"+r_res_id+"' and edt_id='31'"; if(r_batch_no=='-') { sql="select * from edt_res where batch_no='-' and res_id='"+r_res_id+"' and edt_id='31'"; } if(r_res_id=='') break; db_run(sql); shop_edt_num=db_res_ext('num'); input_num=grid_get_v('MG_Item','inp_num',id); shop_num=input_num-request_num; new_shop_num=shop_edt_num+shop_num; new_shop_num_r=shop_edt_num-shop_num; result=db_row_count(); if(request_num==0) {}else { if(oper_type =='check' && r_batch_no=='-' && result == 0) { sql="insert into edt_res (res_id,batch_no,edt_id,num) values ('"+r_res_id+"','-','31',"+shop_num+")"; db_run(sql); } else if(oper_type =='check' && r_batch_no =='-' && result != 0) { sql="update edt_res set num="+new_shop_num+ " where edt_id='31' and res_id='"+r_res_id+"' and batch_no='-' "; db_run(sql); } else if(oper_type =='check' && r_batch_no !='-' && result == 0) { sql="insert into edt_res (res_id,batch_no,edt_id,num) values ('"+r_res_id+"','"+r_batch_no+"','31',"+shop_num+")"; db_run(sql); } else if(oper_type =='check' && r_batch_no !='-' && result != 0) { sql="update edt_res set num="+new_shop_num+ " where edt_id='31' and res_id='"+r_res_id+"' and batch_no='"+r_batch_no+"'"; db_run(sql); } //反审核 else if(oper_type =='check_r' && r_batch_no =='-' && result != 0) { sql="update edt_res set num="+new_shop_num_r+ " where edt_id='31' and res_id='"+r_res_id+"' and batch_no='-' "; db_run(sql); } else if(oper_type =='check_r' && r_batch_no !='-' && result != 0) { sql="update edt_res set num="+new_shop_num_r+ " where edt_id='31' and res_id='"+r_res_id+"' and batch_no='"+r_batch_no+"'"; db_run(sql); } } }; return 1; }; 3、用上面的函数覆盖原来的同名函数就可以了 |
|
|
于 2019-09-30 14:47 被 chymore 修改
|
|
三生石 [个人空间] QQ名 Meng
注册  2005-09-20 发贴数 7383 精华贴 14 原创贴 6 来自 杭州 状态 正常
级别 版主 |
|
|
|
|
三生石上旧精魂 赏月吟风莫要论 惭愧情人远相访 此身虽异性长存
|
|
dragonzsp [个人空间] QQ名 十二个耳环(187199580)
注册  2011-03-25 发贴数 183 精华数 0 原创贴 4 来自 温州 状态 正常
级别 贵宾 |
|
|
不充分了解模块逻辑和表关系,建议别乱改edt_res表,不建议你这么使用 |
|
|
官方认证第三方服务团队 QQ:187199580
收费教程地址链接:http://www.onlyit.cn/topic_list_detail?subject_id=7&topic_id=102140&topic_page_id=1
手机收费版本地址链接:http://www.onlyit.cn/topic_list_detail?subject_id=3&topic_id=103479&topic_page_id=1
|
|
|
|