flexbiz-server 12.4.15 → 12.4.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -300,7 +300,7 @@ const postData = function(obj, ctrl, mainCallback,options={}) {
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
ctrl.beforePost(obj_created, function(e) {
|
|
303
|
-
|
|
303
|
+
console.log("[controllerUtils][postData] [beforePost] ...",ctrl.name,obj_created.so_ct,obj_created.trang_thai,obj_created.listinfo_code,e);
|
|
304
304
|
if (e) return mainCallback(e);
|
|
305
305
|
deletePost(obj_created.user_updated, obj_created, async function(e,_obj,oldBooks) {
|
|
306
306
|
//console.log("[controllerUtils][postData] [deletePost] ...",ctrl.name,obj_created.so_ct,obj_created.trang_thai,obj_created.listinfo_code,e);
|
|
@@ -361,7 +361,7 @@ const postData = function(obj, ctrl, mainCallback,options={}) {
|
|
|
361
361
|
}
|
|
362
362
|
//Chạy post dữ liệu nếu trạng thái yêu cầu post dữ liệu
|
|
363
363
|
setImmediate(()=>{
|
|
364
|
-
|
|
364
|
+
console.log("[controllerUtils][postData] run posting ...",ctrl.name,obj_created.so_ct,obj_created.trang_thai,obj_created.listinfo_code,e);
|
|
365
365
|
post(obj_created, function(e, rs) {
|
|
366
366
|
setImmediate(()=>{
|
|
367
367
|
if(e){
|
|
@@ -370,7 +370,7 @@ const postData = function(obj, ctrl, mainCallback,options={}) {
|
|
|
370
370
|
if(msg_error.indexOf("E11000 duplicate")>=0 && (msg_error.indexOf("id_ct_1_nh_dk_1")>=0 || msg_error.indexOf("id_ct_1_line_1")>=0)){
|
|
371
371
|
return callback(null, rs);
|
|
372
372
|
}
|
|
373
|
-
console.error("[controllerUtils] [
|
|
373
|
+
console.error("[controllerUtils] [postData] error post data",obj_created._id,msg_error);
|
|
374
374
|
deletePost(obj_created.user_updated, obj_created, async function(e_delete_post) {
|
|
375
375
|
if(e_delete_post) {
|
|
376
376
|
console.error("error delete post",e_delete_post)
|
package/server/libs/tinhgiatb.js
CHANGED
|
@@ -426,18 +426,23 @@ module.exports = async function(condition, fn) {
|
|
|
426
426
|
let _model = ctrl?ctrl.getProperty("model"): mongoose.models[voucher_x.ma_ct.toLowerCase()];
|
|
427
427
|
await _model.updateOne({_id:voucher_x._id},voucher_x_data)
|
|
428
428
|
//post lai so sach
|
|
429
|
-
|
|
429
|
+
if (ctrl && ctrl.post) {
|
|
430
430
|
await (new Promise((resolve,reject)=>{
|
|
431
431
|
//console.log("posted book",{ma_ct:voucher_x.ma_ct,so_ct:voucher_x.so_ct,_id:voucher_x_data._id});
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
432
|
+
try{
|
|
433
|
+
Controller.postData(voucher_x_data,ctrl, (e, rs) => {
|
|
434
|
+
if(e){
|
|
435
|
+
console.error("❌ [tinhgiatb] [postData] Lỗi:",e.message,voucher_x_data.so_ct,voucher_x_data.ma_ct);
|
|
436
|
+
return reject(e);
|
|
437
|
+
}
|
|
438
|
+
resolve(rs);
|
|
439
|
+
},{kiem_tra_han_muc_cong_no:false});
|
|
440
|
+
}catch(e){
|
|
441
|
+
reject(e);
|
|
442
|
+
}
|
|
443
|
+
|
|
439
444
|
}));
|
|
440
|
-
}
|
|
445
|
+
}
|
|
441
446
|
callback(null,voucher_x);
|
|
442
447
|
}catch(e){
|
|
443
448
|
console.error("❌ [tinhgiatb] Lỗi cập nhật phiếu xuất:",voucher_x.ma_ct,voucher_x.so_ct,e.message||e.error||e);
|